test-behaviour
/test-behaviour
Dobiera kształt testu, który dowodzi zachowania: reguły domenowej, retry, sesji, interakcji w UI lub wyścigu.
- Autor
- joelhooks ↗
- Repozytorium
- PAROL6 ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 12.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 4
Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Dobiera kształt testu, który dowodzi zachowania: reguły domenowej, retry, sesji, interakcji w UI lub wyścigu.
Wyzwalacze z opisu
Oryginalny opis (EN)
Pick the test shape that proves a behaviour. Use when you ask "how do I test this?", add a test, test a domain rule, a lifecycle, a retry, a session, a UI interaction, a timer, or a race, or review a test that might be tautological.
Jak działa
- 1. A domain rule: a property
- 2. Anything with history: a model
- 3. UI behaviour: a Foldkit Scene
- 4. A seam: one example
- 5. Always: plant a bug
Podgląd SKILL.md
---
name: test-behaviour
description: Pick the test shape that proves a behaviour. Use when you ask "how do I test this?", add a test, test a domain rule, a lifecycle, a retry, a session, a UI interaction, a timer, or a race, or review a test that might be tautological.
plain: "Name what the test proves, pick the shape for it, then plant a bug and watch the test fail."
diagram: |-
what does it prove?
├ domain rule → it.prop
├ history → model test
├ UI behaviour → Scene
└ one seam → example
│
plant a bug → test fails
restore → test passes
---
# Test a behaviour
A test proves one behaviour. Name that behaviour before you write the test. Then pick the shape below that fits it.
Each shape returns a fixed, independent answer. A test that reruns the code under test cannot catch its mistakes. Read [tests that earn their place](https://github.com/joelhooks/rat-stack/blob/main/.brain/resources/lore/tests-that-earn-their-place.svx) first.
## 1. A domain rule: a property
A rule that holds for many inputs is an `it.prop` over Effect `Arbitrary` inputs. Use `it.effect.prop` when the check returns an Effect.
The core suite generates names and checks their length after trimming. The assertion states the accepted length without calling the validator:
```ts repo=rat-stack path=packages/core/test/join-identity.test.ts at=f1e24f7ee9f9b5f4a06574cb8c1646de001e4a3f lines=101-120
```
Read [property-based testing](https://github.com/joelhooks/rat-stack/blob/main/.brain/resources/lore/property-based-testing.svx).
## 2. Anything with history: a model
Sessions, retries, and lifecycles depend on earlier steps. Generate command sequences and check the real system against a small model after each step.
The inspection lifecycle replays generated histories against the real actor:
```ts repo=rat-stack path=packages/core/test/inspect-machine.model.test.ts at=1d4d3252326a216909ccec05e93312d1ab0eaf84 lines=214-219
```
Copy `skills/add-a-lifecycle-machine/templates/lifecycle.model.test.md` for a new machine. Read [model-based testing](https://github.com/joelhooks/rat-stack/blob/main/.brain/resources/lore/model-based-testing.svx).
## 3. UI behaviour: a Foldkit Scene
A Scene runs `update`, the view, and subscriptions together. Input and time are data:
- Input is a step: `pointerDown`, `click`, `type`, or `Subscription.emit`.
- Time is a Command. Resolve it with `Command.resolve(WaitX, CompletedWaitX(...))`.
- Do not use fake timers, a clock, or a DOM.
A race is a plain assertion. Resolve a stale timer after the state has moved on, then assert that nothing broke.
Assert on what the view shows: roles, text, and data attributes. Do not assert on Model fields.
The reader's copy button resolves the copy and then its reset wait:
```ts repo=rat-stack path=apps/web/test/reader.scene.test.ts at=1d4d3252326a216909ccec05e93312d1ab0eaf84 lines=51-69
```
Read [UI behaviour is a scene](https://github.com/joelhooks/rat-stack/blob/main/.brain/resources/lore/ui-behaviour-is-a-scene.svx) for the Foldkit UI Toast race.
## 4. A seam: one example
An example test fits one interface between parts, such as a service over the real filesystem. Keep one, and supply services through a Layer:
```ts repo=rat-stack path=packages/core/test/file-inspector.test.ts at=1d4d3252326a216909ccec05e93312d1ab0eaf84 lines=24-34
```
## 5. Always: plant a bug
1. Break the behaviour the test protects.
2. Run the test. It must fail.
3. Restore the code. The test must pass.
Reject these tests:
- A tautological test computes its expected answer with the code under test.
- A change-detector test fails on any edit and proves no rule.
- A regression test for a bug the suite already covers adds nothing.
Do not rewrite an expected result to match broken code.
Wersje
W bazie nie ma innych skilli o nazwie test-behaviour.
Migawka bazy z 13.11.2026 · wersja paczki 26bbadfec0d9 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100test-retry-config
Prawdopodobnie pomaga konfigurować ponawianie testów w automatyzacji testów i reaguje na frazy związane z retry config. - 100test-first
Wymusza napisanie testu przed kodem przy nowej funkcji, poprawce, refaktoryzacji lub zmianie zachowania w dowolnej bazie kodu. - 100debugging
Znajduje przyczynę błędu, wadliwego testu lub zachowania, a potem naprawia ją z dowodem. - 100spec-binding-review
Ocenia, czy powiązanie testu z scenariuszem dowodzi scenariusza: czy każdy krok Then ma asercję i czy test jest na właściwym poziomie. - 100integration-e2e-testing
Dobiera i projektuje najmniejszy zestaw testów integracyjnych i E2E, który dowodzi zaakceptowanego zachowania na obserwowalnej granicy. - 100tester
Dowodzi zachowania w działającym produkcie: odtwarza zgłoszony błąd przed poprawką i akceptuje zmianę ścieżką użytkownika.