Skip to content

Commit 8f501eb

Browse files
committed
test(11a-2e): make the non-web teardown case bite
Owner follow-up: install the fake agent-browser so a mistaken close reaches the process seam, and assert stderr stays empty (the cleanup-failure channel is how such a close surfaces). Proven against a guard-removed closeManagedBrowser: the test fails on the mockRunCmd call; the production edit was not committed.
1 parent f32c514 commit 8f501eb

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎src/__tests__/daemon-composition/server/daemon-runtime-web-close-teardown.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ test('daemon shutdown reports a web close failure on stderr instead of losing it
132132
// asks the port for every session, and only a web device reaches the agent-browser process.
133133
test('daemon session teardown never dispatches a web close for a non-web session', async () => {
134134
const root = mkdtempForTestSync('agent-device-non-web-teardown-');
135+
// With the fake installed, a close the adapter should never ask for reaches the
136+
// agent-browser process seam (mockRunCmd) and fails below instead of passing silently.
137+
await installFakeManagedAgentBrowser(root);
135138
const sessionStore = new SessionStore(path.join(root, 'sessions'));
136139
sessionStore.publish('android-non-web-teardown-session', {
137140
name: 'android-non-web-teardown-session',
@@ -145,15 +148,17 @@ test('daemon session teardown never dispatches a web close for a non-web session
145148
createdAt: Date.now(),
146149
actions: [],
147150
});
151+
const stderrChunks: string[] = [];
148152

149153
await teardownDaemonSessionForShutdown({
150154
ref: sessionStore.lookup('android-non-web-teardown-session')!,
151155
sessionStore,
152-
stderr: { write: () => {} },
156+
stderr: { write: (chunk) => stderrChunks.push(chunk) },
153157
platformCleanup: platformResourceCleanup,
154158
});
155159

156160
// The snapshot-helper leg is a real-mechanics no-op for a device with no registered helper
157-
// session; the process seam below is what a mistaken web close would have shown up on.
161+
// session; a mistaken web close would surface on the process seam and on stderr below.
158162
expect(mockRunCmd).not.toHaveBeenCalled();
163+
expect(stderrChunks.join('')).toBe('');
159164
});

0 commit comments

Comments
 (0)