Sobes.tech
Middle

Did you write unit tests yourself? What testing tools did you use?

sobes.tech AI

Answer from AI

Yes, I wrote unit tests myself. Depending on the frontend framework and language used, I chose the appropriate tools:

  • For React — I used Jest along with React Testing Library for testing components and logic.
  • For Vue — Vue Test Utils and Jest.
  • For Angular — Jasmine and Karma.

Here's an example of a simple Jest test for a React component:

import { render, screen } from '@testing-library/react';
import Button from './Button';

test('button displays with correct text', () => {
  render(<Button>Click me</Button>);
  expect(screen.getByText('Click me')).toBeInTheDocument();
});

Additionally, I used tools for mocking (e.g., jest.mock) and code coverage checking.