Middle
Did you write unit tests? What was the coverage percentage?
sobes.tech AI
Answer from AI
Yes, I have written unit tests for frontend components and functions. I usually aimed for coverage of about 70-80%, which allowed me to confidently make changes and quickly identify regressions.
An example of a simple unit test in Jest for a React component:
import { render, screen } from '@testing-library/react';
import Button from './Button';
test('renders a button with text', () => {
render(<Button>Click me</Button>);
expect(screen.getByText('Click me')).toBeInTheDocument();
});
It is important that tests cover key logic and user scenarios, not just visual elements.