test-utils icon indicating copy to clipboard operation
test-utils copied to clipboard

Allow to check the parameters sent by using registerEndpoint

Open xavier-ottolini opened this issue 1 year ago • 2 comments

Describe the feature

The function "registerEndpoint" is an interesting feature to check if a request is sent, and to check the response parsing.

However, it would be also useful to check which params are sent in the URL, in the query parameters and in the body.

Additional information

  • [ ] Would you be willing to help implement this feature?
  • [ ] Could this feature be implemented as a module?

Final checks

xavier-ottolini avatar Jul 05 '24 07:07 xavier-ottolini

This would be a great idea! I'm at the same spot now looking for a way to assert that certain API calls have been made. Maybe there is another way to accomplish this.

Cephra avatar Jul 08 '24 17:07 Cephra

@xavier-ottolini @Cephra

hi😺 I’m referring to the test code in the examples directory. For example, in the following test code, the body and query passed to registerEndpoint can be retrieved, so it seems possible to create a test to check the parameters.

examples/app-vitest-full/tests/nuxt/server.spec.ts

yamachi4416 avatar Oct 27 '25 11:10 yamachi4416