testing-requirements
Use when writing tests - test structure, verification steps, coverage goals
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when writing tests - test structure, verification steps, coverage goals
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when refactoring or implementing features - validation, component design, API research
Use when starting work - guidelines for asking questions and commit policies
Use always - non-negotiable rules for TypeScript safety, socket events, and React patterns
Use when working with Electron - IPC security, renderer isolation, Node API access
| name | testing-requirements |
| description | Use when writing tests - test structure, verification steps, coverage goals |
Use this skill when implementing features that need testing or modifying existing tests.
__tests__/ folder next to source filesComponentName.test.tsx or functionName.test.tsglobal.window.electronAPIbeforeEach)Socket Events - Capture handlers:
let handlers: Record<string, (data: unknown) => void> = {}
vi.mock('@/cores/sockets', () => ({
useSocketEvent: (event, handler) => (handlers[event] = handler)
}))
// Trigger event in test
handlers[SocketEvents.DOWNLOAD_START]({ id: 'model-123' })
Zustand Stores:
import { renderHook, act } from '@testing-library/react'
import { useMyStore } from './useMyStore'
const { result } = renderHook(() => useMyStore())
act(() => result.current.setValue('new'))
React Query:
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
const queryClient = new QueryClient()
const wrapper = ({ children }) => (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
)
render(<MyComponent />, { wrapper })
pnpm run test:coverage -- path/to/filesBefore marking work complete, ALWAYS run:
pnpm run type-check - TypeScript validationpnpm run lint - ESLint checkspnpm run format - Prettier formattingpnpm test -- path/to/test - Run specific tests❌ Don't test implementation details
socket.on was called 3 times❌ Don't use any type in tests
unknown, or as unknown as Type❌ Don't skip cleanup
beforeEach