testing-patterns
/testing-patterns
pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.
- Author
- seandkendall ↗
- Repository
- kiro-config ↗
- Licence
- Apache-2.0
- Last repository change
- 26.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.
Original author description
pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.
How it works
- Python Lambda Test (pytest + moto)
- React Component Test (Vitest + RTL)
- Coverage Commands
- Playwright Quick Reference
SKILL.md preview
---
name: testing-patterns
description: pytest with moto, Jest/Vitest with React Testing Library, Playwright E2E patterns. Use when writing or reviewing tests, setting up test infrastructure, or debugging test failures.
---
# Testing Patterns
## Python Lambda Test (pytest + moto)
```python
import pytest
from moto import mock_aws
import boto3, os
@pytest.fixture
def dynamodb_table():
with mock_aws():
os.environ["TABLE_NAME"] = "test-table"
client = boto3.client("dynamodb", region_name="us-east-1")
client.create_table(
TableName="test-table",
KeySchema=[{"AttributeName": "PK", "KeyType": "HASH"}, {"AttributeName": "SK", "KeyType": "RANGE"}],
AttributeDefinitions=[{"AttributeName": "PK", "AttributeType": "S"}, {"AttributeName": "SK", "AttributeType": "S"}],
BillingMode="PAY_PER_REQUEST",
)
yield client
def test_handler_success(dynamodb_table):
from my_function import lambda_handler
result = lambda_handler({"body": '{"name": "test"}'}, MockContext())
assert result["statusCode"] == 200
def test_handler_validation_error(dynamodb_table):
from my_function import lambda_handler
result = lambda_handler({"body": '{}'}, MockContext())
assert result["statusCode"] == 400
```
## React Component Test (Vitest + RTL)
```tsx
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { axe } from 'jest-axe';
test('submits form with valid data', async () => {
const onSubmit = vi.fn();
render(<InvoiceForm onSubmit={onSubmit} />);
await userEvent.type(screen.getByLabelText('Amount'), '100');
await userEvent.click(screen.getByRole('button', { name: 'Submit' }));
expect(onSubmit).toHaveBeenCalledWith(expect.objectContaining({ amount: 100 }));
});
test('has no accessibility violations', async () => {
const { container } = render(<InvoiceForm />);
expect(await axe(container)).toHaveNoViolations();
});
```
## Coverage Commands
- Python: `pytest --cov --cov-report=term-missing --cov-fail-under=90`
- React: `npx vitest --coverage`
- Playwright: `npx playwright test` with `playwright-coverage` or `monocart-coverage-reports`
- Target: 100%. Never settle below 90%.
## Playwright Quick Reference
- Selectors: `page.getByTestId("...")` (uses `data-testid` attribute) — never class/id/tag
- Auth: `storageState` set up once in a setup project, never a UI login flow per test (see `development-quality-gates.md` → "Playwright E2E Standards")
- Waiting: `page.waitForResponse()` / `page.route()` to intercept and wait on network calls, never `page.waitForTimeout(ms)`
- Structure: `tests/e2e/*.spec.ts`, `tests/e2e/pages/*.ts`
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · seandkendall/kiro-config | 100 | Apache-2.0 |
| Reprograme/redevkit | 100 | MIT |
| piomin/claude-ai-spring-boot | 100 | Apache-2.0 |
| FrancoStino/opencode-skills-collection | 100 | MIT |
| rootcastleco/rei-skills | 100 | MIT |
| davila7/claude-code-templates | 100 | MIT |
| svngoku/coding-agents-skills | 100 | MIT |
| organvm-iv-taxis/a-i--skills | 100 | Apache-2.0 |
| leather-io/mono | 100 | MIT |
Database snapshot: 13.11.2026 · package version da6a71b20543 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100react-testing
Test React components with RTL and Jest/Vitest. Use when writing React component tests with React Testing Library, Jest, or Vitest. - 100react-testing
React component testing patterns including components, hooks, context, and forms. Covers Vitest Browser Mode with vitest-browser-react and @testing-library/react. Use when testing React applications. For general UI testing patterns, see the front-end-testing skill. - 90js-testing-patterns
Use when writing or reviewing JavaScript/TypeScript tests - Jest/Vitest assertions, React Testing Library queries, module mocking, async patterns, and snapshot discipline. - 100testing-react
Writes React/TypeScript tests using Vitest and React Testing Library. Use when "write react tests", "vitest", "component test", "hook test", "RTL", "testing library", "snapshot test", or testing React components, hooks, and utilities. - 100nextjs-testing
Write Jest or Vitest unit tests with React Testing Library and Playwright E2E tests for Next.js projects. Use when testing components with RTL, mocking APIs with MSW, or creating Playwright user flow tests. - 100testing
Unit, integration, E2E, load, and a11y tests: pytest, vitest/jest, Playwright, fixtures, mocks, coverage. Use for adding tests or fixing flaky suites.