Write property-based tests
Use property-based testing to auto-generate edge-case inputs and verify fundamental invariants like idempotency and round-trip correctness.
Preview
Copy prompt
Write property-based tests for the following function using [fast-check / Hypothesis / QuickCheck]: [Paste code]. Define 3–5 invariant properties that must hold for all valid inputs, such as idempotency, commutativity, or round-trip encoding. Let the framework generate arbitrary inputs automatically. Document what each property is verifying and configure the framework to shrink failing examples to the minimal reproducing case.
More
Testing
Prompts
