[WIP] Address feedback on redactor config validation#46
Conversation
Add test cases to validate the behavior when duplicate keys are provided to WithRedactionKeys, including: - Duplicate keys in the same call - Keys with different cases (normalized to same key) - Keys already in default keys (should error) - Multiple keys already in defaults (should error) - Mix of duplicate and default keys (should error) The new TestRedactorDuplicateKeys validates that duplicate keys are properly handled by the addedCount logic, ensuring at least one unique key is added. Co-authored-by: hyp3rd <62474964+hyp3rd@users.noreply.github.com>
Co-authored-by: hyp3rd <62474964+hyp3rd@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive test coverage for redactor configuration validation, specifically addressing feedback on handling duplicate keys and keys that are already in the default set. The changes add test cases to ensure the validation logic correctly rejects invalid configurations while accepting valid ones.
Changes:
- Added three new test cases to
TestRedactorInvalidConfigfor scenarios where all provided keys are already in defaults or are duplicates - Added new test function
TestRedactorDuplicateKeyswith three test cases validating successful duplicate key handling scenarios
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| wantMatch bool | ||
| }{ | ||
| { | ||
| name: "duplicate keys in same call - first is added", |
There was a problem hiding this comment.
The comment says "first is added" but it would be more accurate to say "duplicates are silently ignored" or "only unique keys are added". The current wording might suggest that only the first of all keys is added, rather than conveying that duplicate keys are deduped.
| name: "duplicate keys in same call - first is added", | |
| name: "duplicate keys in same call - only unique keys are added", |
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.