GIVEN/WHEN/THEN test structure helps quite a bit to clarify what tests do and what is missing.
This language is borrowed from BDD (Behavior-driven development) but aims to gain the upsides of BDD without the maintaince complexity of BDD frameworks (More on this in BDD Light post).
How to implement
- How to do this in Typescript/vitest: with-describe-and-before-all
- How to do this in Kotlin/kotest: you can just put logic in describe blocks see DescribeSpec