2024-04-29 17:29:46 +08:00
|
|
|
// Package validator ...
|
|
|
|
//
|
|
|
|
// Description : validator ...
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 2024-04-29 14:14
|
|
|
|
package validator
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
2024-09-05 17:49:50 +08:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/tidwall/gjson"
|
2024-04-29 17:29:46 +08:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRun(t *testing.T) {
|
|
|
|
sourceData := map[string]interface{}{
|
|
|
|
"name": "白茶清欢",
|
|
|
|
}
|
|
|
|
_ = Run(sourceData, nil)
|
|
|
|
byteData, _ := json.Marshal(sourceData)
|
|
|
|
fmt.Println(string(byteData))
|
|
|
|
}
|
2024-09-05 17:49:50 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|