Skip to content

Commit

Permalink
ttt
Browse files Browse the repository at this point in the history
Signed-off-by: Jiyong Huang <huangjy@emqx.io>
  • Loading branch information
ngjaying committed Dec 23, 2024
1 parent d7ead3d commit 0c06731
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/topo/node/encode_op_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/lf-edge/ekuiper/v2/internal/pkg/def"
"github.com/lf-edge/ekuiper/v2/internal/xsql"
mockContext "github.com/lf-edge/ekuiper/v2/pkg/mock/context"
"github.com/lf-edge/ekuiper/v2/pkg/timex"
)

func TestEncodeJSON(t *testing.T) {
Expand All @@ -49,7 +50,7 @@ func TestEncodeJSON(t *testing.T) {
&xsql.Tuple{Message: map[string]any{"name": "tom", "age": 21}},
},
},
out: &xsql.RawTuple{Rawdata: []byte(`[{"age":20,"name":"joe"},{"age":21,"name":"tom"}]`)},
out: &xsql.RawTuple{Rawdata: []byte(`[{"age":20,"name":"joe"},{"age":21,"name":"tom"}]`), Timestamp: timex.GetNow()},
},
{
name: "unknown type",
Expand All @@ -74,12 +75,12 @@ func TestEncodeJSON(t *testing.T) {
{"name": "tom", "age": 21},
},
Content: []api.MessageTuple{
&xsql.Tuple{Message: map[string]any{"name": "joe", "age": 20}},
&xsql.Tuple{Message: map[string]any{"name": "tom", "age": 21}},
&xsql.Tuple{Message: map[string]any{"name": "joe", "age": 20}, Timestamp: timex.GetNow()},
&xsql.Tuple{Message: map[string]any{"name": "tom", "age": 21}, Timestamp: timex.GetNow()},
},
Props: map[string]string{"{{.a}}": "1"},
},
out: &xsql.RawTuple{Rawdata: []byte(`[{"age":20,"name":"joe"},{"age":21,"name":"tom"}]`), Props: map[string]string{"{{.a}}": "1"}},
out: &xsql.RawTuple{Rawdata: []byte(`[{"age":20,"name":"joe"},{"age":21,"name":"tom"}]`), Props: map[string]string{"{{.a}}": "1"}, Timestamp: timex.GetNow()},
},
}
ctx := mockContext.NewMockContext("test1", "encode_test")
Expand Down

0 comments on commit 0c06731

Please sign in to comment.