返回 Skill 列表
extension
分类: 开发与工程无需 API Key

implementing-testing-strategy

使用Vitest进行质量保证协议。用于诸如定价和可用性计算等关键逻辑。

person作者: jakexiaohubgithub

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

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.