Lesson 24 / 33

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.

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.