Create comprehensive unit tests for components, modules, stores, and utilities. Use when asked to write tests, add test coverage, or test a specific file.
Create unit tests following project conventions.
/testing:unit-tests [target] - Create tests for specific file/testing:unit-tests scan - Find files needing testsimport { describe, expect, it } from 'vitest';
describe('MyComponent', () => {
it('renders correctly', async () => {
// Mount component with test utilities
// Assert expected behavior
});
});
import { describe, expect, it } from 'vitest';
describe('useMyModule', () => {
it('returns expected structure', () => {
const result = useMyModule();
expect(result).toBeDefined();
});
});
import { describe, expect, it } from 'vitest';
describe('MyStore', () => {
it('initializes correctly', () => {
const store = useMyStore();
expect(store.items).toEqual([]);
});
});
| Source | Test Location |
|---|---|
src/components/Card.vue | tests/components/Card.test.ts |
src/composables/useData.ts | tests/composables/useData.test.ts |
src/stores/data.ts | tests/stores/data.test.ts |