en un clic
testing-patterns
TDD workflow and testing patterns
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
TDD workflow and testing patterns
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle SOC
Git commit conventions and workflow
Guide for breaking features into atomic, implementable tasks
Author safe RalphX Agent Workflow scripts that orchestrate durable delegated agents through the high-level workflow API.
Guide for analyzing git diff and refining QA test plans
Guide for generating QA test steps with agent-browser commands
Narrow RalphX Agent Workspace bridge playbook for workflow events delivered into an existing Agent Workspace conversation.
| name | testing-patterns |
| description | TDD workflow and testing patterns |
| disable-model-invocation | true |
| user-invocable | false |
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
describe('MyComponent', () => {
it('should render the title', () => {
render(<MyComponent title="Hello" />);
expect(screen.getByText('Hello')).toBeInTheDocument();
});
it('should call onChange when clicked', async () => {
const onChange = vi.fn();
render(<MyComponent onChange={onChange} />);
await userEvent.click(screen.getByRole('button'));
expect(onChange).toHaveBeenCalled();
});
});
import { renderHook, act } from '@testing-library/react';
it('should increment counter', () => {
const { result } = renderHook(() => useCounter());
act(() => {
result.current.increment();
});
expect(result.current.count).toBe(1);
});
// Mock Tauri invoke
vi.mock('@tauri-apps/api/core', () => ({
invoke: vi.fn(),
}));
// Mock module
vi.mock('./api', () => ({
fetchData: vi.fn().mockResolvedValue({ data: [] }),
}));
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_addition() {
assert_eq!(add(2, 2), 4);
}
#[test]
#[should_panic(expected = "divide by zero")]
fn test_divide_by_zero() {
divide(1, 0);
}
}
#[tokio::test]
async fn test_async_operation() {
let result = fetch_data().await;
assert!(result.is_ok());
}
// tests/integration.rs
use ralphx_lib::AppState;
#[tokio::test]
async fn test_full_workflow() {
let state = AppState::new_test();
// Test complete workflow
}
Follow the target project's local validation instructions. Select only the affected test file, module, crate, or named test; do not turn these examples into a full-suite completion gate.
# TypeScript
npm run test:run -- <affected-test-file>
# Rust
cargo test <test_or_module_filter> --lib
cargo nextest run --test <affected-suite> -E 'test(<test_or_module_filter>)'