refactor: align frontend with FSD architecture
This commit is contained in:
99
docs/testing.md
Normal file
99
docs/testing.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# Testing Policy
|
||||
|
||||
Дата актуализации: 2026-06-22
|
||||
|
||||
## Обязательные проверки перед сдачей
|
||||
|
||||
```bash
|
||||
bun run format:check
|
||||
bun run check:full
|
||||
```
|
||||
|
||||
`check:full` запускает:
|
||||
|
||||
- ESLint;
|
||||
- Steiger FSD lint;
|
||||
- Vitest unit tests;
|
||||
- TypeScript typecheck;
|
||||
- production build;
|
||||
- Playwright E2E.
|
||||
|
||||
## Текущее покрытие
|
||||
|
||||
Unit:
|
||||
|
||||
- dashboard filter normalization;
|
||||
- dashboard API params;
|
||||
- structured query keys;
|
||||
- dashboard empty state;
|
||||
- chart adapters;
|
||||
- sorting;
|
||||
- formatting/pluralization;
|
||||
- tooltip escaping;
|
||||
- dashboard filter draft mapping;
|
||||
- dashboard filter definitions;
|
||||
- `CompetenceMapFilterField` render/v-model contract;
|
||||
- auth login schema;
|
||||
- auth safe redirect helper;
|
||||
- UI-kit entrypoint smoke.
|
||||
|
||||
E2E:
|
||||
|
||||
- redirect protected route `/dashboard` to `/auth` without auth session;
|
||||
- auth form empty validation.
|
||||
|
||||
## Что нужно покрыть следующим этапом
|
||||
|
||||
Component tests:
|
||||
|
||||
- `CompetenceMapFilters.vue`: open/sync draft, apply, reset, cancel, disabled/loading state;
|
||||
- `DashboardTabs.vue`: tab selection and region rating branch;
|
||||
- `RegionRankingCard.vue`: sort controls;
|
||||
- `TopIndustriesCard.vue`: empty and filled states;
|
||||
- `ChartTooltipPortal.vue`: visibility and positioning contract.
|
||||
|
||||
E2E with mocked backend:
|
||||
|
||||
- authorized dashboard load;
|
||||
- all/sez/technoparks/clusters tabs;
|
||||
- filters dialog apply/reset/cancel;
|
||||
- ranking table sort;
|
||||
- region rating tab;
|
||||
- mobile layout smoke.
|
||||
|
||||
Visual regression:
|
||||
|
||||
- desktop auth page;
|
||||
- desktop dashboard all/sez/technoparks/clusters;
|
||||
- filters dialog;
|
||||
- mobile dashboard top section.
|
||||
|
||||
## Правила написания тестов
|
||||
|
||||
- Pure helpers тестировать unit-тестами без Vue mount.
|
||||
- Page-specific UI тестировать рядом с owner slice.
|
||||
- UI-kit internals не тестировать в page tests; для сложных компонентов использовать stubs или E2E.
|
||||
- API-зависимые E2E должны использовать route mocks, а не реальный backend.
|
||||
- Для security-sensitive строковых HTML templates обязательно оставлять tests на escaping.
|
||||
- После изменения FSD-границ всегда запускать `bun run lint:fsd`.
|
||||
|
||||
## Известные build warnings
|
||||
|
||||
Сборка проходит, но Vite/Rolldown предупреждает:
|
||||
|
||||
- `INVALID_ANNOTATION` в `node_modules/@vueuse/core/dist/index.js`;
|
||||
- главный chunk больше 500 kB.
|
||||
|
||||
Это не runtime failures. Bundle size требует отдельного performance-pass с анализатором чанков.
|
||||
|
||||
## Известные test warnings
|
||||
|
||||
Vitest component test для Vue SFC может печатать jsdom warning:
|
||||
|
||||
```text
|
||||
Could not parse CSS stylesheet
|
||||
```
|
||||
|
||||
Тесты при этом проходят. Это связано с парсингом runtime-injected SFC/UI-kit CSS в jsdom, а не с
|
||||
ошибкой production CSS. Если warning начнет мешать CI logs, стоит добавить test setup с точечной
|
||||
фильтрацией этого сообщения или вынести component tests на browser-based runner.
|
||||
Reference in New Issue
Block a user