fix(test): add missing getRuntimeMetrics mock to MockSession (#92)

The production code calls connection.session.getRuntimeMetrics() when
closing the WebSocket server, but MockSession in the relay-reconnect
tests didn't implement this method, causing all close() calls to throw.
This commit is contained in:
Josep Lluis Giralt D'Lacoste ( Pep )
2026-03-07 22:35:18 +08:00
committed by GitHub
parent cfb9784ea9
commit 870d95f35e
@@ -37,6 +37,15 @@ const sessionMock = vi.hoisted(() => {
handleMessage = vi.fn(async () => {});
handleBinaryFrame = vi.fn((_frame: unknown) => {});
getClientActivity = vi.fn(() => null);
getRuntimeMetrics = vi.fn(() => ({
checkoutDiffTargetCount: 0,
checkoutDiffSubscriptionCount: 0,
checkoutDiffWatcherCount: 0,
checkoutDiffFallbackRefreshTargetCount: 0,
terminalDirectorySubscriptionCount: 0,
terminalSubscriptionCount: 0,
terminalStreamCount: 0,
}));
readonly args: Record<string, unknown>;
constructor(args: Record<string, unknown>) {