Skip to content

fix(tests): populate Set in idGenerator tests (#266)#304

Merged
ilteoood merged 2 commits intofastify:mainfrom
williamfds:fix/idGenerator-test
Oct 24, 2025
Merged

fix(tests): populate Set in idGenerator tests (#266)#304
ilteoood merged 2 commits intofastify:mainfrom
williamfds:fix/idGenerator-test

Conversation

@williamfds
Copy link
Contributor

What

Add calls to ids.add(id) inside the loop in both idGenerator tests so that the Set is actually populated and the test detects real collisions.

Why

Without this line, the Set remains empty and ids.has(id) never returns true, making the test pass even if the generator produces duplicate IDs. With this change, we ensure the test only passes if there are truly no collisions.

Closes #266


Checklist

  • Run npm run test and npm run benchmark
  • Tests and/or benchmarks are included (already existed and were adjusted)
  • Documentation is changed or added (no docs affected)
  • Commit message and code follow the Developer’s Certificate of Origin and the Code of Conduct

@williamfds williamfds requested a review from Eomm June 1, 2025 12:55
@ilteoood ilteoood merged commit fe47827 into fastify:main Oct 24, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential bug in unit test for idGenerator

5 participants