-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ShouldJSONEqual assertion (ovh#676)
* Add ShouldJSONEqual assertion Signed-off-by: Philipp Gillé <[email protected]> * Fix example in Godoc Signed-off-by: Philipp Gillé <[email protected]> * Improve Godoc Signed-off-by: Philipp Gillé <[email protected]> * Add to test suite Signed-off-by: Philipp Gillé <[email protected]> * Add ShouldJSONEqual to README Signed-off-by: Philipp Gillé <[email protected]> * Support primitive JSON values Signed-off-by: Philipp Gillé <[email protected]> --------- Signed-off-by: Philipp Gillé <[email protected]> Signed-off-by: Fokion Sotiropoulos <[email protected]>
- Loading branch information
1 parent
0be0726
commit 0caeacf
Showing
4 changed files
with
326 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: test ShouldJSONEqual | ||
testcases: | ||
- name: test assertion | ||
steps: | ||
- type: exec | ||
script: | | ||
echo '{ | ||
"o" : { | ||
"a" : 1, | ||
"b" : 2, | ||
"c" : { | ||
"x":1, | ||
"y":2 | ||
} | ||
}, | ||
"a" : [1,2], | ||
"s" : "foo", | ||
"n" : 1.2, | ||
"t" : true, | ||
"f" : false, | ||
"z" : null | ||
}' | ||
assertions: | ||
- result.systemoutjson.o ShouldJSONEqual ' { "c":{ "y" :2 , "x" :1 }, "b" :2 , "a" :1 } ' | ||
- result.systemoutjson.o.c ShouldJSONEqual ' { "y" :2 , "x" :1 }' | ||
- result.systemoutjson.a ShouldJSONEqual ' [ 1 , 2 ] ' | ||
- result.systemoutjson.s ShouldJSONEqual 'foo' | ||
- result.systemoutjson.n ShouldJSONEqual 1.2 | ||
- result.systemoutjson.t ShouldJSONEqual true | ||
- result.systemoutjson.f ShouldJSONEqual false | ||
- result.systemoutjson.z ShouldJSONEqual null | ||
- result.systemoutjson.z ShouldJSONEqual 'null' # ⚠️ Shouldn't be valid, but is required for above `null` check to work | ||
- result.systemoutjson.z ShouldJSONEqual '' # ⚠️ Shouldn't be valid, but Venom treats null as empty string |