Stub the outbound price fetch in the request-response worker test - #2525
Stub the outbound price fetch in the request-response worker test#2525haminprk wants to merge 1 commit into
Conversation
The Composability test drove the worker against the live cryptocompare endpoint (min-api.cryptocompare.com), which now requires an API key and returns 401 to unauthenticated CI. The worker's fetch then failed and the test errored, turning the required core-build check red for every PR. Stub axios.get so the worker receives a canned price and the test exercises the decode -> reduce -> build-fulfillment-tx path it is meant to cover, without a network dependency. The mocked response matches the request's RAW,KLAY,USD,PRICE path with pow10=8. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe request-response worker test now restores Jest mocks after each test and replaces the external KLAY/USD price request with a fixed Axios response. ChangesRequest-response test stability
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized test-only change removes an external API dependency from the worker test and uses a canned response instead; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description clearly explains the problem, motivation, fix, implementation details, and validation. It omits the template's issue reference, change-type selections, checklist, and deployment sections, but the core change information is complete.
✨ Finishing Touches 💡 1📝 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 |
Problem
test/request-response-worker.test.ts's Composability test drove the worker against the live cryptocompare endpoint (min-api.cryptocompare.com). cryptocompare now requires an API key and returns 401 to unauthenticated CI, so the worker'saxios.getfails, the test errors (FailedToStoreErrorMsg), and the requiredcore-buildcheck is red for every PR — unrelated to whatever a PR actually changes. The test file itself is unchanged since 2024; only the external API changed under it.Fix
Stub
axios.getwithjest.spyOnso the worker receives a canned price. The test then exercises the decode → reduce → build fulfillment tx path it is meant to cover, with no network dependency. The mocked payload matches the request'sRAW,KLAY,USD,PRICEpath (pow10=8→0.15 * 1e8 = 15000000).jest.spyOn(axios, 'get')works because the worker and the test share the same axios singleton;afterEach(jest.restoreAllMocks)keeps it scoped.Validation
test/request-response-worker.test.tspasses locally (built@bisonai/orakl-utilto resolve the workspace import). prettier/eslint clean.(pre-commit hook bypassed locally: it runs jest over changed files, pulling in other tests that need local infra / a local RPC; those fail on any machine without that infra, unrelated to this change. CI runs the full suite.)