Skip to content

Commit 714bcd3

Browse files
author
issinitsyn
committed
Added tests with float type
1 parent 6c83689 commit 714bcd3

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

core/matching/matchers/json_match_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,15 @@ func Test_JsonMatch_MatchesTrueWithJSON_WithInt64(t *testing.T) {
121121

122122
Expect(matchers.JsonMatch(`{"test":{"id":112769992360719990160}}`, `{"test":{"id":112769992360719990160}}`)).To(BeTrue())
123123
}
124+
125+
func Test_JsonMatch_MatchesFalseWithJSON_WithFloat64(t *testing.T) {
126+
RegisterTestingT(t)
127+
128+
Expect(matchers.JsonMatch(`{"test":{"id":11.2769992360719990160}}`, `{"test":{"id":11.2769992360719990161}}`)).To(BeFalse())
129+
}
130+
131+
func Test_JsonMatch_MatchesTrueWithJSON_WithFloat64(t *testing.T) {
132+
RegisterTestingT(t)
133+
134+
Expect(matchers.JsonMatch(`{"test":{"id":11.2769992360719990160}}`, `{"test":{"id":11.2769992360719990160}}`)).To(BeTrue())
135+
}

core/matching/matchers/json_partial_match_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,15 @@ func Test_JsonPartialMatch_MatchesTrueWithJSON_WithInt64(t *testing.T) {
391391

392392
Expect(matchers.JsonMatch(`{"test":{"id":112769992360719990160}}`, `{"test":{"id":112769992360719990160}}`)).To(BeTrue())
393393
}
394+
395+
func Test_JsonPartialMatch_MatchesFalseWithJSON_WithFloat64(t *testing.T) {
396+
RegisterTestingT(t)
397+
398+
Expect(matchers.JsonMatch(`{"test":{"id":11.2769992360719990160}}`, `{"test":{"id":11.2769992360719990161}}`)).To(BeFalse())
399+
}
400+
401+
func Test_JsonPartialMatch_MatchesTrueWithJSON_WithFloat64(t *testing.T) {
402+
RegisterTestingT(t)
403+
404+
Expect(matchers.JsonMatch(`{"test":{"id":11.2769992360719990160}}`, `{"test":{"id":11.2769992360719990160}}`)).To(BeTrue())
405+
}

0 commit comments

Comments
 (0)