validator/run_test.go

45 lines
876 B
Go

// Package validator ...
//
// Description : validator ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2024-04-29 14:14
package validator
import (
"encoding/json"
"fmt"
"github.com/stretchr/testify/assert"
"github.com/tidwall/gjson"
"testing"
)
func TestRun(t *testing.T) {
sourceData := map[string]interface{}{
"name": "白茶清欢",
}
_ = Run(sourceData, nil)
byteData, _ := json.Marshal(sourceData)
fmt.Println(string(byteData))
}
func Test_getDataStatus(t *testing.T) {
type args struct {
val gjson.Result
dataType string
}
tests := []struct {
name string
args args
want string
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equalf(t, tt.want, getDataStatus(tt.args.val, tt.args.dataType), "getDataStatus(%v, %v)", tt.args.val, tt.args.dataType)
})
}
}