writing-tests
SolidWrite and edit test files that model real user flows. Use when creating, modifying, or reviewing test files.
AI & Automation 842 stars
66 forks Updated today MIT
Install
Quality Score: 90/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Writing Tests
## Core Principle: Tests Are User Flows
Each test should represent a single, concrete flow that a real user would follow when interacting with the system. Write tests at the same abstraction level as the user experiences the system.
## Rules
### 1. Match the user's interface exactly
The test should call the system the same way a user would. If the system is a CLI, the test should invoke the CLI with argument strings. If it's a library, the test should call the public API. Don't wrap the interface in test-specific helpers that hide what's actually happening.
**Good** — the test reads like what a user would do:
```ts
const result = await librettoCli("setup --skip-browsers");
expect(result.exitCode).toBe(0);
const result2 = await librettoCli("--help");
expect(result2.stdout).toContain("Usage:");
```
**Bad** — extra abstraction obscures the actual interaction:
```ts
const result = await setupWithDefaults(); // hides the real CLI invocation
assertSuccess(result); // hides what "success" means
```
### 2. Keep tests verbose and concrete
Don't introduce helpers for brevity. The value of a test is that you can read it top-to-bottom and understand exactly what's happening. Repetition across tests is fine — each test should be self-contained and readable on its own.
### 3. One flow per test
Each test should exercise one coherent user scenario from setup through assertion. Don't combine unrelated flows into a single test, and don't split one logical flow acr...
Details
- Author
- saffron-health
- Repository
- saffron-health/libretto
- Created
- 4 months ago
- Last Updated
- today
- Language
- TypeScript
- License
- MIT
Bundled in these plugins
Similar Skills
Semantically similar based on skill content — not just same category
Testing & QA Listed
write-tests
Use whenever writing, editing, or reviewing tests, in any language or framework.
1 Updated yesterday
Jean-PierreGassin AI & Automation Solid
write-tests
Use when a module or function lacks tests and you need to generate meaningful unit or integration tests that cover the real behaviour.
1 Updated 5 days ago
NSBen AI & Automation Solid
test-writing
Write comprehensive tests for code including unit tests, integration tests, and end-to-end tests. Use this to ensure code quality, catch bugs, and validate functionality.
35 Updated 1 weeks ago
KarmaloopAI