chore(tests): update and clarify test naming conventions

This commit is contained in:
Jirka Bažant
2026-02-19 14:24:04 +01:00
committed by Jiří Bažant
parent 45e4e38421
commit 8081af4403
2 changed files with 1 additions and 8 deletions

View File

@@ -37,5 +37,4 @@ Before submitting code, ensure:
- [ ] Fixtures are properly typed
- [ ] Tests focus on behavior, not implementation
- [ ] All interactions use `userEvent`
- [ ] Tests follow naming conventions (.comp.test.tsx, .hook.test.ts)
- [ ] All tests pass locally

View File

@@ -27,9 +27,7 @@ expect(screen.getByText(getTranslation('path.to.translation'))).toBe(
## Naming conventions
- Tests are placed in `__tests__` folders and have `.test.ts` extension.
- Test folder is placed in same directory as actual implementation
- When testing components suffix should be `.comp.test.tsx`.
- When testing hooks suffix should be `.hook.test.ts`.
- Test folder is placed in the same directory as an actual implementation.
- When testing types, suffix should be `.type-test.ts`, to prevent from being executed by jest. (For example: `packages/utils/tests/typedObjectFromEntries.type-test.ts`)
- Fixtures are placed in `mocks` folders and have `mock` prefix.
- `mocks` folder is placed in the root of the package, not in `src`.
@@ -42,11 +40,7 @@ my-module/
│ └── mockMyComponent.ts
└── src/
├── __tests__/
│ ├── MyComponent.comp.test.tsx
│ ├── useMyData.hook.test.ts
│ └── utils.test.ts
├── MyComponent.tsx
├── useMyData.ts
└── utils.ts
```