← Back to PRs

#19104: test(discord): improve gateway logging test coverage

by Clawborn open 2026-02-17 11:30 View on GitHub →
channel: discord size: XS trusted-contributor
Adds 2 tests to gateway-logging.test.ts: - formatGatewayMetrics edge cases: null, undefined, string, number, boolean, bigint, circular/unserializable objects - No-op cleanup when emitter is undefined <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds two new tests to `src/discord/gateway-logging.test.ts` to improve coverage of the `attachDiscordGatewayLogging` function: - **Metrics formatting edge cases**: Tests `formatGatewayMetrics` with `null`, `undefined`, string, number, boolean, `BigInt`, and a circular reference object. All assertions correctly match the implementation's branching logic. - **No-op cleanup for undefined emitter**: Verifies that when no emitter is provided, the function returns a callable no-op cleanup without throwing. Both tests follow the existing test patterns in the file, use proper mocking via `vi.mocked`, and clean up after themselves. No issues found. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge — it only adds test coverage with no changes to production code. - The PR exclusively adds test code. All test assertions correctly match the source implementation. No production code is modified, and the tests follow established patterns in the file. - No files require special attention. <sub>Last reviewed commit: 375ecb6</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs