Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Add more tests for serialization of field syntax #350

Merged
merged 1 commit into from
Jan 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions entry/field_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ func TestFieldUnmarshalJSON(t *testing.T) {
NewBodyField("test1", "test2"),
},
{
"RootField",
"BodyShort",
[]byte(`"$"`),
NewBodyField([]string{}...),
NewBodyField(),
},
{
"BodyLong",
[]byte(`"$body"`),
NewBodyField(),
},
}

Expand Down Expand Up @@ -80,6 +85,11 @@ func TestFieldMarshalJSON(t *testing.T) {
NewBodyField("test1", "test2"),
[]byte(`"test1.test2"`),
},
{
"BodyLong",
NewBodyField(),
[]byte(`"$body"`),
},
}

for _, tc := range cases {
Expand Down Expand Up @@ -108,11 +118,6 @@ func TestFieldUnmarshalYAML(t *testing.T) {
[]byte(`test1`),
NewBodyField("test1"),
},
{
"RootField",
[]byte(`"$"`),
NewBodyField([]string{}...),
},
{
"ComplexField",
[]byte(`"test1.test2"`),
Expand All @@ -123,6 +128,16 @@ func TestFieldUnmarshalYAML(t *testing.T) {
[]byte(`"$.test1.test2"`),
NewBodyField("test1", "test2"),
},
{
"BodyShort",
[]byte(`"$"`),
NewBodyField(),
},
{
"BodyLong",
[]byte(`"$body"`),
NewBodyField(),
},
}

for _, tc := range cases {
Expand Down Expand Up @@ -161,7 +176,7 @@ func TestFieldMarshalYAML(t *testing.T) {
"test1.test2\n",
},
{
"EmptyField",
"Body",
NewBodyField(),
"$body\n",
},
Expand Down