Golang Json Assert
A Go library for testing JSON strings.
Mission
I could not find any library implementing the "Conform behavior", which checks,
if JSON objects are downwards-compatible, therefore testing if there is a semantic versioning major bump change.
Usage
For full specification of the library see pkg/jsonassert_test.go
.
In a Nutshell, given to strings, the library can check for strict equality:
actual := `
{
"name": "Lars",
"age": 12
}
`
Expect(actual).ToEqual(actual)
But, It can also check, if a JSON conforms with another. This means, that in theory
actual and expected value are schematically compatible. This can be used to ensure that
diffrent JSON objects provide some compability.
actual := `
{
"name": "Lars",
"age": 12
}
`
expect := `
{
"age": 12
}
`
Expect(actual).ToConform(expect)
Contribution
If you feel like there are missing some assertions / specifications, feel free to open an issue / Submit a PR.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ go test
License
The MIT License (MIT). Please see License File for more information.