# E2E Testing — NestJS

Source: https://www.geekswithgeeks.com/en/nestjs/nestjs-e2e-testing

> Full end-to-end testing of your application.

## E2E setup & fixtures

Set up a test database and fixtures; tear them down after each test.

```typescript
beforeAll(async () => {
  // spin up test database
  // seed with test data
});

afterEach(async () => {
  // clean up created records
});

afterAll(async () => {
  // tear down test database
  await app.close();
});
```

## Separate test vs prod config

Use `.env.test` with a separate database; your CI can read it and spin up a clean DB for each test run.
