Enums
Enum type arguments are forged as a random member of the enum. Both numeric and string enums are supported, and every member — including the one valued 0 — is reachable.
Numeric enums
Each call rolls independently, so a Status[] array typically contains different members. The member with the numeric value 0 participates in the roll like any other.
String enums
The forged value is the member's value, not its name, and membership in Object.values(Kind) always holds — safe for equality checks against enum constants.
Explicit values
Explicit numbering works the same way as auto-incremented:
Pinning a member
When a test is specifically about one member, pin it with createWith:
Enums vs literal unions
Both now forge correct members for every call. The choice is modeling, not behavior:
Literal union | Enum | |
|---|---|---|
Random member per call | yes | yes |
Falsy members ( | reachable | reachable |
Enum API ( | no | yes |
Needs a declaration statement | no (inline allowed) | yes |
Keep enums where production code benefits from the enum API; use literal unions for inline constraints in test doubles.