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

isJson assertion returns the error "Invalid Chai property" #132

Closed
dcoomber opened this issue Mar 18, 2023 · 3 comments
Closed

isJson assertion returns the error "Invalid Chai property" #132

dcoomber opened this issue Mar 18, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@dcoomber
Copy link
Member

Description

isJson assertion returns the error Invalid Chai property: json. Did you mean "to"?

Test collection

Test collection: https://github.com/dcoomber/exploring-bruno/tree/dpc_session_1/exploration/02-create/EE%20Bookings

Test request: "Retrieve a booking"

Screenshot

Screenshot 2023-03-18 at 11 54 53

@helloanoop
Copy link
Contributor

Thanks for catching this @dcoomber !

Would you be able to work on fixing this?
The code is here

@helloanoop helloanoop added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Mar 19, 2023
dcoomber added a commit to dcoomber/bruno that referenced this issue Mar 19, 2023
@dcoomber
Copy link
Member Author

I have ended up proposing the use of https://github.com/chaijs/chai-http, but am uncertain if this is what you're looking for.
chai-http .to.be.json is merely a check that the response headers includes Content-Type: application/json. In this form, the assertion would only ever be valid when comparing against res and would not be usable for comparisons of subsets of the response structure.

Please let me know if you had a different solution in mind.

@dcoomber
Copy link
Member Author

After reviewing https://www.chaijs.com/api/plugins/ along with stepping through some of the other assertions, I realised that we're looking to addProperty and not addMethod.

PR updated.

dcoomber added a commit to dcoomber/bruno that referenced this issue Mar 22, 2023
helloanoop added a commit that referenced this issue Mar 23, 2023
Resolve issue with to.be.json assertions Re #132
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants