Sobes.tech
Middle

What tests did you write, for what, and what did you test?

sobes.tech AI

Answer from AI

In the frontend, I wrote several types of tests:

  • Unit tests: check individual functions and components for correctness. For example, testing utilities, form validation, rendering React components.
  • Integration tests: verify the interaction of multiple components or modules together, such as a form with validation and data submission.
  • E2E tests (end-to-end): simulate user behavior in the browser, testing the full application workflow using tools like Cypress or Selenium.

The goal of tests is to increase reliability, prevent regressions, and ensure that the user interface works as intended.

An example of a simple unit test in Jest for a sum function:

function sum(a, b) {
  return a + b;
}

test('sum adds two numbers', () => {
  expect(sum(2, 3)).toBe(5);
});
What tests did you write, for what, and what did you… - sobes.tech