test: assert the test-mode gateway guard through sendPrompt and gbot_send - #68
Conversation
… tool against a loopback server
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Follow-up to #64, which the owner merged before these two commits landed on its branch. Test-only: applies test behavior, not implementation to the test-mode gateway guard tests (would the test pass if every import returned
undefined? no).Behavior-test check
test/gateway-send.test.js: real loopback HTTP server; asserts the literalsendPromptresult object for a loopback session, then — withGROK_BOT_ALLOW_ANY_GATEWAY=1switched on — the literal refusal message for the non-routablehttps://gateway.invalid(production policy would let it through; test mode must not) and that the server saw exactly the two loopback requests. Replaces afetchmock call-count assertion.test/url-policy.test.js: asserts the literalRejected … test mode …messages for gateway and backend hosts instead of a shared/test mode/regex.tests/route-unit/tools.test.ts: invokes thegbot_sendMCP tool withhttps://gateway.invalid+GROK_BOT_ALLOW_ANY_GATEWAY=1and asserts the literal tool error text and an empty fake-gateway call log, then invokes it against the loopback fake and asserts the literalstructuredContent. Replaces anexpect(process.env.GROK_BOT_TEST).toBe('1')pin.Verification
npm run test:unit201/201,npm run build && npm run test:routes14/14npx changeset status --since=origin/main: nothing to bump (tests are outsidechangedFilePatterns), soChangeset presentpasses without a labelReview
change-risk-reviewer(Sol) reviewed these test changes on #64's branch: one Medium (a guard regression would have contacted the realbox.cursor.sh) — addressed by targetinggateway.invalidwith the escape hatch on. Nothing else remained.