Junior — Middle
What types of testing have you implemented in your projects?
sobes.tech AI
Answer from AI
In Node.js projects, I have implemented several types of testing:
- Unit Testing — testing individual functions and modules using Jest or Mocha.
- Integration Testing — testing the interaction between modules and with the database, for example, using Supertest for API.
- E2E Testing (End-to-End) — testing the entire application, often with Cypress or Puppeteer.
Example of a simple unit test with Jest:
const sum = (a, b) => a + b;
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});