← Back to list
1. Domain Layer (
2. Application Layer (
3. Infrastructure Layer (
4. Presentation Layer (

testing
by jmgomezdev
Mobile store code testing
⭐ 0🍴 0📅 Jan 22, 2026
SKILL.md
name: testing description: > Testing strategies based on Clean Architecture layers. Trigger: Invoke when writing tests to enforce layer-specific mocking strategies (Unit vs Integration) license: Apache-2.0 metadata: author: jmgomezdev version: '1.0'
🧠 Rules by Layer
1. Domain Layer (src/domain)
- Type: Pure Unit Tests.
- Mocks: ❌ NONE.
- Focus: Test business logic, Zod schema validations (
.parse()), and utility functions. - Example:
expect(productSchema.parse(invalidData)).toThrow().
2. Application Layer (src/application)
- Type: Unit Tests.
- Mocks: ✅ Mock Infrastructure Repositories and Zustand Stores.
- Focus:
- Test
queryOptionsgeneration keys. - Test complex hooks logic (use
renderHook). - Test Zustand actions (state mutations).
- Test
- Tooling:
vi.spyOn,mockZustand.
3. Infrastructure Layer (src/infrastructure)
- Type: Integration Tests.
- Mocks: ✅ Mock HTTP Network (use
mswornock). - Focus:
- Verify Repositories call the correct endpoints.
- Verify Mappers correctly transform API DTOs -> Domain Entities.
- Verify DTOs match expected API shapes.
4. Presentation Layer (src/presentation)
- Type: Component Integration Tests.
- Mocks: ✅ Mock Application Layer Hooks (e.g.,
useProductDetail). - Forbidden: ❌ NEVER mock
axios,fetch, oruseQuerydirectly in components. - Focus:
- Test UI rendering based on data states (Success, Empty).
- Test User Interactions (Click, Type) firing handlers.
- Test Accessibility (
aria-labels).
- Tooling:
render,screen,userEvent.
📝 Conventions
- Naming:
Filename.test.tsxorFilename.spec.ts. - Location: Co-located next to the source file.
- Async: Always use
await screen.findBy*for async elements, neverwait().
Keywords
vitest, react-testing-library, rtl, user-event, msw, unit-testing, integration-testing, mocks.
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon