[AE-200] Add integration tests for PUT /links update endpoint#6
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded three PUT test scenarios for Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@links.hurl`:
- Around line 143-149: The test uses a fixed missing ID in the PUT request ("PUT
{{BASE_URL}}/links/nonexistent123") which can collide with a real record; change
it to generate a per-run unique missing ID (e.g., append a timestamp or UUID) or
derive a guaranteed-nonexistent id from the existing template variable (e.g.,
"{{urlId}}-missing-<timestamp>" or "{{urlId}}-uuid") before issuing the PUT to
/links/:id so the 404 check is stable; update the request URL to use that
generated value while leaving the payload and Authorization intact.
- Around line 130-141: After asserting the PUT with invalid "url" returns HTTP
400 and code 126, add a follow-up GET to the same endpoint (GET
{{BASE_URL}}/links/{{urlId}}) and assert the resource was not mutated by
verifying jsonpath "$.originalUrl" == "https://www.ayrshare.com/updated"; this
ensures the failed update is side-effect free for the link identified by urlId.
- Around line 121-127: The assertion "jsonpath \"$.shortUrl\" exists" is too
weak; change it to assert the returned shortUrl equals the previously stored
short URL variable (e.g. jsonpath "$.shortUrl" == "{{shortUrl}}") so the update
endpoint cannot return a different short link; update the assertion that uses
the jsonpath expression for "$.shortUrl" to compare against the existing
template variable ({{shortUrl}}) tied to the original link rather than merely
checking existence.
- Assert shortUrl contains urlId instead of just exists - Add GET after failed 400 PUT to verify no side effects - Replace hardcoded nonexistent123 with zZzZzZ_no_match - Assert error codes (126, 418) on failure responses Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
links.hurl: happy path, invalid URL (400), and non-existent link (404)urlIdTest plan
hurl --test --variables-file vars-dev.env links.hurlafter link-shortener and ayrshare PRs are deployed🤖 Generated with Claude Code
Summary by CodeRabbit