पाठ 24 / 33

E2E Testing

आपके application की full end-to-end testing।

E2E setup और fixtures

Test database और fixtures को setup करें; हर test के बाद उन्हें tear down करें।

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();
});

Test vs prod config को अलग करें

अलग database के साथ .env.test का उपयोग करें; आपका CI इसे पढ़ सकता है और हर test run के लिए clean DB spin up कर सकता है।