Files
cats.e2e-spec.ts
What you'll learn
- Create an application from a compiled testing module with createNestApplication() and init(), configured as main.ts configures it
- Send requests with supertest and assert status, body and headers in its expect() forms
- Manage one application per file with beforeAll and afterAll, and know what an e2e test proves that a unit test cannot
Press Run tests to start the app. Its log appears here.Tests
- test/cats.e2e-spec.tsrun to see its tests
Bugs your tests must catch
Each of these replaces one file with a buggy version and runs your tests again. A bug is caught when at least one test fails against it. Tests that pass whatever the code does are not tests.
- POST /cats answers 200 instead of 201cats/cats.controller.ts
- a created cat is returned but never storedcats/cats.service.ts
- a missing cat answers 200 with an empty bodycats/cats.service.ts
- a non-numeric id is a 404 instead of a 400cats/cats.controller.ts