feat(companion): support runtime client autoConnect mode

This commit is contained in:
William Valentin
2026-02-16 18:36:50 -08:00
parent 5db7beeb53
commit 8d123cf859
5 changed files with 67 additions and 2 deletions
+27
View File
@@ -268,4 +268,31 @@ describe('CompanionRuntimeClient', () => {
client.disconnect();
}
});
it('supports autoConnect mode for one-shot RPC usage', async () => {
if (!LISTEN_ALLOWED) {
return;
}
const client = new CompanionRuntimeClient({
url: `ws://127.0.0.1:${TEST_PORT}`,
token: TEST_TOKEN,
autoConnect: true,
});
expect(client.connected).toBe(false);
try {
const register = await client.registerNode({
nodeId: 'auto-connect-node',
role: 'companion',
capabilities: ['ui.canvas'],
});
expect(register.registered).toBe(true);
expect(client.connected).toBe(true);
} finally {
client.disconnect();
}
});
});