feat(companion): support runtime client autoConnect mode
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user