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

Unable to verify content of POST request #866

Closed
Praetorss opened this issue Aug 16, 2021 · 1 comment
Closed

Unable to verify content of POST request #866

Praetorss opened this issue Aug 16, 2021 · 1 comment

Comments

@Praetorss
Copy link

I have a scenario when request is being made to save customer details.
After mocking the request and ensuring that it is called I am struggling to verify the actual content of the request.

One thing is that thanks to MSW I can ensure that the request is being called at the correct URL. However, the body contains data that I must ensure is valid when the request is made.

I am struggling to see how this can be achieved? Is this a missing feature or is there a way of verifying this?

@kettanaito
Copy link
Member

Hey, @Praetorss. Thank you for reaching out.

Please see our view at request (and response) assertions. In short, whenever you can confirm the validity of your request/response data in the UI—always prefer that. For example, your POST response may derive some UI state and some elements with the corresponding text appear on the page. Testing those elements is always recommended, as it's precisely what the user of your product will see.

There are, however, cases when responses aren't reflected in the UI. If you're absolutely sure this is your case, consider using the Life-cycle API and basing your assertion around that.

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

2 participants