AgentSkillsCN

implementing-testing-strategy

采用 Vitest 构建质量保证协议,尤其适用于定价与库存可用性等关键逻辑的校验。

SKILL.md
--- frontmatter
name: implementing-testing-strategy
description: Quality assurance protocols using Vitest. Use for critical logic like pricing and availability calculations.

Testing Strategy

When to use this skill

  • Building core business logic (e.g., "Calculate Group Discount").
  • Before major refactors.

Tools

  • Vitest: Fast, Vite-compatible runner.
  • React Testing Library: For component testing (optional/high-priority items only).

Example Test

typescript
import { calculatePrice } from './pricing';
import { expect, test } from 'vitest';

test('applies 10% discount for groups > 5', () => {
    expect(calculatePrice(100, 6)).toBe(540); 
});

Instructions

  • Focus: Test logic, not the UI (avoid testing that "a button is blue").
  • Mocks: Mock Appwrite SDK calls locally to avoid hitting the live API during tests.