Skip to content

🦄 new(testing): add property-based testing with fast-check #23

@UniquePixels

Description

@UniquePixels

Summary

Integrate fast-check for property-based testing alongside the existing example-based Bun test suite.

Motivation

Property-based testing generates random inputs to find edge cases that hand-written examples miss. Good candidates in Unicorn:

  • attempt() — verify error wrapping holds for arbitrary thrown values (strings, errors, objects, undefined)
  • Schema helpers — validate that snowflakeId, secretString, and config schemas reject/accept arbitrary inputs correctly
  • Component pattern matching — verify parameterized ID parsing with arbitrary string patterns
  • Guard composition — verify guard chains short-circuit correctly with arbitrary pass/fail combinations

Scope

  • Install fast-check as a dev dependency
  • Add property-based tests alongside existing tests (not replacing them)
  • Start with attempt() and schema helpers as initial targets
  • Document pattern in .claude/testing-reference.md

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions