frontend-testing by aj-geddes/useful-ai-prompts
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill frontend-testing为前端应用程序构建全面的测试套件,包括单元测试、集成测试和端到端测试,并提供适当的覆盖率和断言。
最小工作示例:
// Button.test.tsx
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { Button } from './Button';
describe('Button Component', () => {
it('renders button with text', () => {
render(<Button>Click me</Button>);
expect(screen.getByRole('button')).toHaveTextContent('Click me');
});
it('calls onClick handler when clicked', () => {
const handleClick = jest.fn();
render(<Button onClick={handleClick}>Click</Button>);
fireEvent.click(screen.getByRole('button'));
expect(handleClick).toHaveBeenCalledTimes(1);
});
it('disables button when disabled prop is true', () => {
render(<Button disabled>Click me</Button>);
expect(screen.getByRole('button')).toBeDisabled();
});
it('applies variant styles correctly', () => {
// ... (完整实现请参阅参考指南)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/ 目录下的详细实现:
| 指南 | 内容 |
|---|---|
| Jest Unit Testing (React) | Jest 单元测试 (React) |
| React Testing Library Integration Tests | React Testing Library 集成测试 |
| Vitest for Vue Testing | 用于 Vue 测试的 Vitest |
| Cypress E2E Testing | Cypress 端到端测试 |
| Test Coverage Configuration | 测试覆盖率配置 |
每周安装量
122
代码仓库
GitHub 星标数
121
首次出现
2026年1月21日
安全审计
安装于
gemini-cli101
opencode100
codex96
cursor89
claude-code87
github-copilot83
Build comprehensive test suites for frontend applications including unit tests, integration tests, and end-to-end tests with proper coverage and assertions.
Minimal working example:
// Button.test.tsx
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { Button } from './Button';
describe('Button Component', () => {
it('renders button with text', () => {
render(<Button>Click me</Button>);
expect(screen.getByRole('button')).toHaveTextContent('Click me');
});
it('calls onClick handler when clicked', () => {
const handleClick = jest.fn();
render(<Button onClick={handleClick}>Click</Button>);
fireEvent.click(screen.getByRole('button'));
expect(handleClick).toHaveBeenCalledTimes(1);
});
it('disables button when disabled prop is true', () => {
render(<Button disabled>Click me</Button>);
expect(screen.getByRole('button')).toBeDisabled();
});
it('applies variant styles correctly', () => {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Jest Unit Testing (React) | Jest Unit Testing (React) |
| React Testing Library Integration Tests | React Testing Library Integration Tests |
| Vitest for Vue Testing | Vitest for Vue Testing |
| Cypress E2E Testing | Cypress E2E Testing |
| Test Coverage Configuration | Test Coverage Configuration |
Weekly Installs
122
Repository
GitHub Stars
121
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli101
opencode100
codex96
cursor89
claude-code87
github-copilot83
代码审查最佳实践指南:完整流程、安全与性能审查清单
12,400 周安装
Claude技能创建与分享工具 - 自动化技能开发、团队协作与Slack集成
1,100 周安装
LangSmith Fetch 代理调试技能 - 快速调试 LangChain/LangGraph 代理执行轨迹
1,100 周安装
内部沟通AI技能:自动生成3P更新、公司通讯、FAQ回复等内部沟通内容
1,100 周安装
开发者成长分析技能:基于Claude聊天历史识别编码模式与改进领域
1,200 周安装
Connect技能:让Claude AI连接1000+应用执行真实操作,告别纯文本生成
1,200 周安装
Anthropic品牌风格指南技能 - 获取官方品牌标识、颜色、字体和视觉设计规范
1,100 周安装