skilly. Buy ad slot
All skills
Community / AGENT SKILL

react-testing

Vitammiin/agent-vorcl-flow
0 installs 2 GitHub stars
0

Тестирование React-компонентов — Testing Library + Vitest/Jest, поведенческие проверки от лица пользователя, MSW для мокинга сети. Use при написании или ревью тестов фронтенда.

BEFORE YOU INSTALL

Understand the trade-offs.

SECURITY REVIEW

Not yet assessed

Review the original instructions and requested permissions before installing.

No security review is available for this catalog entry yet.

SKILL QUALITY

Not yet assessed

How clearly the skill guides your agent, how complete its workflow is, and how you can check the outcome.

No quality assessment is available for this catalog entry yet.

The full skill.

Original instructions from the publisher’s SKILL.md

# Навык: React testing

Поведенческие тесты компонентов на **Testing Library** + **Vitest** (или Jest).

## Принцип
- Тестируй поведение, а не реализацию.
- Поиск по ролям/тексту: `getByRole`, `getByLabelText`, `findByText`; `data-testid` — крайняя мера.
- Взаимодействие — `@testing-library/user-event`.

## Структура (AAA)
- Arrange (рендер + провайдеры) → Act (действие) → Assert (видимый результат).
- Провайдеры (QueryClientProvider, стор, тема) — через `renderWithProviders`.

## Сеть и данные
- Мокай границу сети через **MSW**, не внутренние модули.
- Свежий `QueryClient` на тест, `retry: false`.

## Асинхронность
- `await findBy*` / `await waitFor(...)`; не по таймингу.
- Проверяй loading/empty/error, не только happy path.

## Пример
```tsx
test('показывает заказы', async () => {
  renderWithProviders(<OrdersList />);
  expect(await screen.findByText('Заказ #1')).toBeInTheDocument();
});
```