test (route): add table-driven tests for route IDs with multiple underscores#1039
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a new test function ChangesRoute ID Underscore Parsing Test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Comment |
ID parsing is already covered by TestExtractAgencyIDAndCodeID in utils/api_test.go. Keep only the handler-level assertions.
|



Description
The current
GET /api/where/route/{id}implementation usesstrings.SplitN(id, "_", 2)to parse the agency and entity IDs. While this correctly handles entity IDs containing underscores, there was no test coverage explicitly validating this edge case, leaving it vulnerable to future regressions.Changes Made:
TestRouteHandler_EntityIDWithUnderscorestoroute_handler_test.go.KCM_40_100479,AGENCY_part1_part2_part3).404 Not Found(since the dummy routes do not exist in the test DB) rather than a400 Bad Request.Fixes: #1010
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests