36 lines
1.1 KiB
Markdown
36 lines
1.1 KiB
Markdown
|
|
---
|
||
|
|
paths:
|
||
|
|
- "nodes/*/test/**"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Testing Rules
|
||
|
|
|
||
|
|
## 3-Tier Test Structure
|
||
|
|
Every node must have:
|
||
|
|
- `test/basic/*.test.js` — Unit tests for individual functions
|
||
|
|
- `test/integration/*.test.js` — Node interaction and message passing tests
|
||
|
|
- `test/edge/*.test.js` — Edge cases, error conditions, boundary values
|
||
|
|
- `test/helpers/` (optional) — Shared test utilities for this node
|
||
|
|
|
||
|
|
## Test Runner
|
||
|
|
```bash
|
||
|
|
node --test nodes/<nodeName>/test/basic/*.test.js
|
||
|
|
node --test nodes/<nodeName>/test/integration/*.test.js
|
||
|
|
node --test nodes/<nodeName>/test/edge/*.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 must maintain:
|
||
|
|
- `examples/README.md`
|
||
|
|
- `examples/basic.flow.json`
|
||
|
|
- `examples/integration.flow.json`
|
||
|
|
- `examples/edge.flow.json`
|
||
|
|
|
||
|
|
## No Node-RED Runtime in Unit Tests
|
||
|
|
Basic tests should test specificClass domain logic without requiring a running Node-RED instance.
|