Generate comprehensive unit tests for a Spark UI component using Vitest and React Testing Library. Use when the user wants to add tests, improve test coverage, or test a specific component.
60
70%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./.cursor/skills/generate-tests/SKILL.mdCreate or update unit tests for Spark UI components following the project's testing standards.
Test File Location: Tests go in ComponentName.test.tsx in the component directory
Testing Library Setup:
@testing-library/user-event for interactionsTest Structure:
import { describe, it, expect } from 'vitest'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { ComponentName } from './ComponentName'
describe('ComponentName', () => {
it('should render', () => {
render(<ComponentName {...defaultProps} />)
expect(screen.getByRole('...')).toBeInTheDocument()
})
it('should be accessible', () => {
// Accessibility tests
})
})What to Test:
Accessibility Testing:
Run Tests:
npm run test:ui for watch modenpm run test:run for single runnpm run test:coverage for coverage reportReference existing test files in packages/components/src/*/ComponentName.test.tsx for patterns.
76a3678
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.