Files
EVOLV/.claude/rules/testing.md

32 lines
1.2 KiB
Markdown
Raw Normal View History

---
paths:
- "nodes/*/test/**"
---
# Testing Rules
## Test Structure
Every node has at minimum:
- `test/basic/*.test.js` — Unit tests for individual functions (specificClass domain logic)
- `test/integration/*.test.js` — Node interaction and message passing tests
- `test/helpers/` (optional) — Shared test utilities for this node
Edge-case tests live wherever they fit (in `basic/` for pure-logic edges, in `integration/` for runtime edges). Don't require a separate `test/edge/` directory.
## Test Runner
```bash
node --test nodes/<nodeName>/test/basic/*.test.js
node --test nodes/<nodeName>/test/integration/*.test.js
```
## Test Requirements
- Every behavior change requires a failing-before/passing-after test
- Tests must validate against function anchor expected behavior
- Example flows (`examples/`) must stay in sync with implementation
## Example Flows
Each node should ship at least one runnable example under `examples/` plus an `examples/README.md` describing it. Beyond that, add only what the node's complexity demands — not every node needs separate basic/integration/edge flow files.
## No Node-RED Runtime in Unit Tests
Basic tests should test specificClass domain logic without requiring a running Node-RED instance.