-
Notifications
You must be signed in to change notification settings - Fork 323
test(validation): add entity tuple validation regression assertions #3138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package validation_test | ||
|
|
||
| import ( | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestWave1TupleValidationEdgeCases(t *testing.T) { | ||
| validateEntity := func(entityType, entityID string) bool { | ||
| if entityType == "" || entityID == "" { | ||
| return false | ||
| } | ||
| if len(entityType) > 64 || len(entityID) > 128 { | ||
| return false | ||
| } | ||
| return true | ||
| } | ||
|
Comment on lines
+8
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift Exercise the production validator.
🤖 Prompt for AI Agents |
||
|
|
||
| if !validateEntity("user", "usr_100234") { | ||
| t.Errorf("expected valid entity to pass validation") | ||
| } | ||
|
|
||
| if validateEntity("", "usr_100234") { | ||
| t.Errorf("expected empty entity type to fail validation") | ||
| } | ||
|
|
||
| if validateEntity("user", "") { | ||
| t.Errorf("expected empty entity ID to fail validation") | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add maximum-length boundary assertions.
The helper checks lengths above 64 and 128 characters, but the test does not supply oversized values. Add cases for a 65-character entity type and a 129-character entity ID, and assert that the production validator rejects them.
🤖 Prompt for AI Agents