fix: cover uncovered lines from claim check PR#103
Conversation
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
PR SummaryLow Risk Overview New tests validate Reviewed by Cursor Bugbot for commit 76d4d1b. Bugbot is set up for automated code reviews on this repo. Configure here. |
WalkthroughTest coverage expanded across five files spanning NATS Jetstream error handling, object store mocking, publish outcome logging, Slack server routing, and HTTP configuration validation. All changes are additions to test modules without any production code modifications. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Code Coverage SummaryDetailsDiff against mainResults for commit: 76d4d1b Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
rsworkspace/crates/trogon-nats/src/jetstream/mocks.rs (1)
850-851: Strengthen the post-failure assertion to validate payload content.Line 850 currently checks only
is_ok(). Verifying returned bytes makes the test resilient against false positives where the wrong data is returned.Proposed test strengthening
- let result = ObjectStoreGet::get(&store, "key").await; - assert!(result.is_ok()); + let mut reader = ObjectStoreGet::get(&store, "key").await.unwrap(); + use std::io::Read; + let mut buf = Vec::new(); + reader.read_to_end(&mut buf).unwrap(); + assert_eq!(buf, b"data");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rsworkspace/crates/trogon-nats/src/jetstream/mocks.rs` around lines 850 - 851, The test currently only asserts that ObjectStoreGet::get(&store, "key").await returned Ok; update it to unwrap or pattern-match the Ok value and assert the returned payload equals the expected bytes (e.g., compare the returned Vec<u8> or slice to the known expected payload for "key"). Specifically, after calling ObjectStoreGet::get(&store, "key").await, extract the payload from the Ok variant (or use expect()) and add an equality assertion against the expected byte sequence so the test verifies content as well as success.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@rsworkspace/crates/trogon-nats/src/jetstream/mocks.rs`:
- Around line 850-851: The test currently only asserts that
ObjectStoreGet::get(&store, "key").await returned Ok; update it to unwrap or
pattern-match the Ok value and assert the returned payload equals the expected
bytes (e.g., compare the returned Vec<u8> or slice to the known expected payload
for "key"). Specifically, after calling ObjectStoreGet::get(&store,
"key").await, extract the payload from the Ok variant (or use expect()) and add
an equality assertion against the expected byte sequence so the test verifies
content as well as success.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ceaa20ab-98d1-44bc-b8b6-24fb6a2ff882
📒 Files selected for processing (5)
rsworkspace/crates/trogon-nats/src/jetstream/claim_check.rsrsworkspace/crates/trogon-nats/src/jetstream/mocks.rsrsworkspace/crates/trogon-nats/src/jetstream/publish.rsrsworkspace/crates/trogon-source-slack/src/server.rsrsworkspace/crates/trogon-std/src/http.rs
ClaimResolveErrorDisplay impl,PublishOutcome::StoreFailedlogging,MockObjectStoreget-failure path and Default impl,HttpBodySizeMax::new(0)None arm, and the publicrouter()function in slack source