docs(test): make Given/When/Then the default BDD structure (WP-71)
bdd.mdx previously banned "Given/When/Then ceremony" outright, which
directly contradicted WP-70's own acceptance tests (Acceptance/
BesluitLifecycleTests.cs already used // Given/When/Then comments) and
the backend's organically-evolved PascalCase_snake_sentence convention,
which the doc gave zero guidance for. Reverses that rule: every test is
now structured Given -> When -> Then, with a genuinely empty phase
omitted rather than faked; present-tense declarative naming and the
one-behaviour-per-test rule are unchanged. ADR-0006 gets a cross-reference
so both documents agree everywhere, not just in acceptance tests.
Also closes out the doc's other named-but-unenforced rules found by the
audit: fixes the 5 files asserting rendered $localize copy instead of
the underlying tag/message-id (the compliant pattern already existed in
werkvoorraad-item-view.spec.ts), splits the multi-behaviour titles the
doc itself calls a smell (";", "and", "/"), and fixes bdd.mdx's own false
citation of registratie-wizard.machine.spec.ts as "one transition per
test" by actually splitting that test into one-transition-per-test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -133,6 +133,17 @@ boundary row is the deliberate exception, not a contradiction: there the entire
|
||||
test is to exercise what happens when the input _isn't_ valid, so the fixture must be able to
|
||||
represent the invalid shape a builder would refuse to construct.
|
||||
|
||||
## A note on Given/When/Then and `bdd.mdx`
|
||||
|
||||
This ADR's "Given.Concept()...Build()" builder chain and the acceptance-test row above
|
||||
("composed into one Given→When→Then read") already used Given/When/Then before it was the
|
||||
repo-wide default. `libs/shared/docs/bdd.mdx` has since made G/W/T structure — a `// Given` /
|
||||
`// When` / `// Then` comment (or, in TypeScript, the equivalent unlabelled ordering) inside
|
||||
every test body, acceptance or not — the documented convention for **all** tests, not only
|
||||
acceptance ones (reversing its own earlier "no G/W/T ceremony" rule). The two documents now
|
||||
agree everywhere: this ADR's `Given` builder is the fixture idiom; `bdd.mdx` rule 1 is the
|
||||
structural convention every test using that fixture (and every other test besides) follows.
|
||||
|
||||
## Consequences
|
||||
|
||||
- **+** An illegal backend fixture (e.g. a decided-but-not-submitted `Aanvraag`) is now a
|
||||
|
||||
Reference in New Issue
Block a user