29 lines
559 B
Go
29 lines
559 B
Go
package main
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestNormalizeJSONEmptyValues(t *testing.T) {
|
|
input := map[string]any{
|
|
"json_null": nil,
|
|
"nil_text": "nil",
|
|
"null_text": " NULL ",
|
|
"normal": "connected",
|
|
"nested": []any{nil, "NIL", 1.0},
|
|
}
|
|
want := map[string]any{
|
|
"json_null": "",
|
|
"nil_text": "",
|
|
"null_text": "",
|
|
"normal": "connected",
|
|
"nested": []any{"", "", 1.0},
|
|
}
|
|
|
|
got := normalizeJSONEmptyValues(input)
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("normalizeJSONEmptyValues() = %#v, want %#v", got, want)
|
|
}
|
|
}
|