Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying strings when using path-based expectJSON #216

Open
PyvesB opened this issue Apr 7, 2019 · 0 comments
Open

Allow specifying strings when using path-based expectJSON #216

PyvesB opened this issue Apr 7, 2019 · 0 comments

Comments

@PyvesB
Copy link

PyvesB commented Apr 7, 2019

When calling expectJSON with the optional path argument, you can't specify a string as the jsonTest parameter.

Example response:

{
  "key1": {
    "key2": "value1"
  },
  "key3": "value2"
}

Calling expectJSON('key1.key2', 'value1'), is not possible, as the second argument value1 is not an object.

expectContainsJSON could be used as an alternative, however, its syntax isn't as concise especially with more complex JSON structures, and the error messages are much more vague as we're checking that a structure contains another. It would be nice to have something that gets to the point by strictly comparing a string at a given path with an expected string.

Support for this could either be implemented in expectJSON itself or as a separate helper function.

See the discussions here for more context.

Cheers,

Pyves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant