eykrehbein / strest

⚡️ CI-ready tests for REST APIs configured in YAML
MIT License
1.74k stars 59 forks source link

Validation Rules do not work for some special values (false, 0, null, ...) #130

Closed Beutlin closed 5 years ago

Beutlin commented 5 years ago

Describe the bug After the request the validation of json data is in some cases wrong.

To Reproduce

  1. Call some page which returns this simple JSON: { a: false, b: 0, c: null }

  2. Validate a, b, c in your config with: {jsonpath: content.a, expect: false, jsonpath: content.b, expect: 0, jsonpath: content.c, expect: null }

  3. Result: Schema Validation failed: "\"expect\" must be a boolean"

Expected behavior No errors, as the returned value and the expected value are the same.

Additional context Have a look at https://dorey.github.io/JavaScript-Equality-Table/. Here are some corner cases which value of variables might be compared to the corresponded value.

Beutlin commented 5 years ago

Oh, I've just seen that this issue is already fixed on the master branch. Maybe you can update the version of your software, thus that users who install strest with npm also benefit from it.