#Testing controllers and app

7 messages · Page 1 of 1 (latest)

shy palm
#

What is the general approach to doing more integration/e2e type tests?

I unit test my controllers functions returning the correct object shape etc. but for testing guards and such do people write them in a .spec.ts file or .e2e-spec.ts file?

wide osprey
#

I usually do them in an e2e-spec and make use of a tool called pactum for http testing

shy palm
#

Thanks for your input. I have some tests that are e2e-spec but still mock a small part of the application or disable things like global auth guards so it feels a bit wrong to call them “e2e” but they’re not exactly unit tests

wide osprey
#

You could make an intermediary int-spec for integration testing, but that's one more test type to worry about

shy palm
#

Do you keep your e2e-spec in that tests folder or do you put some close to your modules as well?

wide osprey
#

In the tests directory

#

Unit tests with three implementation, e2e on their own