Skip to content

test: strengthen weak assertions in test suite #116

@edloidas

Description

@edloidas

Several tests in the suite use assertions weak enough to let real regressions pass. SeededRNG tests for float, NaN, and Infinity seeds only verify same-seed reproducibility — they never assert the documented uint32 coercion (SeededRNG(42.999) === SeededRNG(42), SeededRNG(NaN | Infinity) === SeededRNG(0)). invalid maxDice falls back to default asserts only .not.toThrow(), so an implementation that silently used Infinity would still pass. nextInt inverted-bounds and trivial-range tests check membership in range but not equivalence to non-inverted bounds or RNG-state preservation. The CLI --verbose test uses three loose toContain checks instead of an exact match against the deterministic seeded output. Two MockRNG exhaustion tests use expect(true).toBe(false) (yielding "expected true to be false" failure messages), and one versus metadata propagation test asserts only result.degree.toBeDefined() instead of the expected DegreeOfSuccess.Failure.

Rationale

These weak assertions reduce the suite to a smoke test for the affected paths — a regression that broke SeededRNG normalization, the maxDice cap, or nextInt state preservation could ship without a failing test. Replacing them with behavior-level checks (exact-match assertions, equivalence between equivalent inputs, state-preservation invariants) restores the suite as a meaningful safety net.

Drafted with AI assistance

Metadata

Metadata

Assignees

Labels

testingBuild, tests and CI related features and issues

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions