#70
test: add unit tests for src/secrets.ts
Adds test/secrets.test.ts covering the three exports of src/secrets.ts:
- secretEquals: matching strings, non-matching, empty, unicode, different lengths
- deriveSigningKey: returns a usable HMAC key, caches same material, different material → different key
- hmacHex: 64-char hex output, determinism, distinct messages → distinct digests
12 tests, all pass under bun test.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Tests
- Added coverage for secret comparison, signing-key derivation, and HMAC digest generation.
- Added checks for matching and non-matching secrets, empty and Unicode inputs, deterministic results, key reuse, and distinct outputs for different inputs.
- Verified HMAC signatures and hexadecimal digests have the expected formats and lengths.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
fdb7d9c6-3600-405a-93f8-4f6382a6ae05📥 Commits
Reviewing files that changed from the base of the PR and between 5c241afbb44e01f9e60a2d6184b6ce3621c83b36 and 6a1895cfdaa4ada7d7277ee12941621656f6b228.
📒 Files selected for processing (1)
test/secrets.test.tsIncluded review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.
📝 Walkthrough
Walkthrough
The pull request adds
test/secrets.test.ts. The tests coversecretEquals,deriveSigningKey, andhmacHex, including comparison cases, key caching, signature differences, and hexadecimal digest output.Changes
Secrets module tests
test/secrets.test.tsPriority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Other
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.