Summary
NetworkInspectorServer still has no direct unit test coverage on origin/master. Its internal logic - certificate exchange medium resolution, device connection mapping, async client initialization, and start/stop error propagation - is currently exercised only through integration paths or adjacent command/manager tests.
This issue supersedes #2702.
Current coverage already in place
Those cover the command and manager portions originally mentioned here. The remaining gap is server-level coverage for src/extension/networkInspector/networkInspectorServer.ts.
Suggested scope
- Add
test/extension/networkInspector/networkInspectorServer.test.ts using sinon + proxyquire, matching existing test style.
- Cover
transformCertificateExchangeMediumToType for medium values 1, 2, and unknown/undefined fallback.
- Cover
start() failure propagation when secure server config or server startup fails.
- Cover
addConnection / removeConnection map management, including the async client.init() lifecycle where the client is returned before initialization completes and then inserted into connections.
- Cover disconnection during initialization so the lifecycle behavior is explicit and regression-tested.
Evidence
origin/master contains test/extension/networkInspector/networkInspectorManager.test.ts and test/extension/networkInspector/startStopCommands.test.ts.
origin/master does not contain test/extension/networkInspector/networkInspectorServer.test.ts.
src/extension/networkInspector/networkInspectorServer.ts still contains untested branches around transformCertificateExchangeMediumToType, initialisePromise, addConnection, and removeConnection.
Validation
npm test should include the new server test file and pass.
- Server tests should run without a live device or real network inspector connection.
Closes #2702
Summary
NetworkInspectorServerstill has no direct unit test coverage onorigin/master. Its internal logic - certificate exchange medium resolution, device connection mapping, async client initialization, and start/stop error propagation - is currently exercised only through integration paths or adjacent command/manager tests.This issue supersedes #2702.
Current coverage already in place
test/extension/networkInspector/networkInspectorManager.test.tsfor manager start/stop lifecycle behavior.test/extension/networkInspector/startStopCommands.test.tsforStartNetworkInspectorandStopNetworkInspectorcommand wrappers.Those cover the command and manager portions originally mentioned here. The remaining gap is server-level coverage for
src/extension/networkInspector/networkInspectorServer.ts.Suggested scope
test/extension/networkInspector/networkInspectorServer.test.tsusing sinon + proxyquire, matching existing test style.transformCertificateExchangeMediumToTypefor medium values1,2, and unknown/undefined fallback.start()failure propagation when secure server config or server startup fails.addConnection/removeConnectionmap management, including the asyncclient.init()lifecycle where the client is returned before initialization completes and then inserted intoconnections.Evidence
origin/mastercontainstest/extension/networkInspector/networkInspectorManager.test.tsandtest/extension/networkInspector/startStopCommands.test.ts.origin/masterdoes not containtest/extension/networkInspector/networkInspectorServer.test.ts.src/extension/networkInspector/networkInspectorServer.tsstill contains untested branches aroundtransformCertificateExchangeMediumToType,initialisePromise,addConnection, andremoveConnection.Validation
npm testshould include the new server test file and pass.Closes #2702