Repository navigation
test: migrate network tool tests to unit tests - #2754
Conversation
- Convert list_network_requests and get_network_request handlers to mock unit tests using createHandlerMocks - Remove obsolete snapshot file and withMcpContext overhead
|
Hi @OrKoN, Following up from #2729, this PR migrates
All tests and formatting checks pass cleanly. Could you please take a look when you have a moment? Thanks! |
Summary of ChangesConverting Missed E2E / Integration Test CoverageBecause the deleted tests in 1. Inline Response Body Eviction (
|
OrKoN
left a comment
There was a problem hiding this comment.
Requesting changes per my previous comment.
- Test NetworkFormatter inline body eviction with <not available anymore> - Test McpResponse forwarding includePreservedRequests to page.getNetworkRequests - Test McpPage getNetworkRequests and getNetworkRequestById delegation - Retain real browser redirect integration test using setUpNetworkCollectorForTesting
|
@OrKoN Thank you for the detailed feedback! I have addressed all 4 coverage gaps:
All formatting checks and tests are passing. Ready for another look! |
- Stub page.emulationSettings directly in McpResponse test - Remove emulationSettings initialization from createMockMcpPage in tests/mocks.ts - Restore Copyright 2025 in tests/tools/network.test.ts
# Conflicts: # tests/tools/network.test.ts
|
Hi @OrKoN , |
Description
This PR migrates
tests/tools/network.test.tsoffwithMcpContextto fast mock-based unit tests usingcreateHandlerMocks():list_network_requestsandget_network_requesthandlers intests/tools/network.test.tsto mock unit tests verifying parameter parsing, default fallbacks, DevTools UI selection resolution, and delegation topageandresponse.tests/tools/network.test.js.snapshotandwithMcpContext/serverHooks()overhead, reducing test duration from ~45s to ~5s.tests/collectors/PageCollector.test.ts(NetworkCollector) andtests/formatters/NetworkFormatter.test.ts.Test Plan
npm run buildnode scripts/test.js tests/tools/network.test.tsnode scripts/test.js tests/collectors/PageCollector.test.tsnode scripts/test.js tests/formatters/NetworkFormatter.test.tsnpm run check-formatnpm run docs:generate