mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-05 05:24:13 +00:00
test(puter-js): fail credential lookups until the relay hits one
The reconnect test made the next credential lookup fail once, but the SDK's own socket.io connection could take that failure before the relay's reconnect attempt did, so the relay never saw a failed lookup and the test failed in CI. Lookups now fail until the relay has refused an attempt on one, then recover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
41a9da9c72
commit
2425c7a30d
1 file changed
+14
-6
@@ -433,18 +433,26 @@ describe('convo built SDK and browser media', () => {
|
||||
const warn = vi.spyOn(console, 'warn');
|
||||
try {
|
||||
await conversation.connect();
|
||||
auth.mockRejectedValueOnce(new Error('auth store unavailable'));
|
||||
// Every lookup fails, the SDK's own socket.io connection included,
|
||||
// until the relay has refused a reconnect attempt on one.
|
||||
auth.mockRejectedValue(new Error('auth store unavailable'));
|
||||
for (const socket of proxied) socket.destroy();
|
||||
await vi.waitFor(
|
||||
() =>
|
||||
expect(warn).toHaveBeenCalledWith(
|
||||
'[realtime] credential lookup failed',
|
||||
expect.objectContaining({
|
||||
message: 'auth store unavailable',
|
||||
}),
|
||||
),
|
||||
{ timeout: 10_000 },
|
||||
);
|
||||
auth.mockRestore();
|
||||
await log.until(() =>
|
||||
log.events.some(
|
||||
(event) => event.type === 'ready' && event.reconnected,
|
||||
),
|
||||
);
|
||||
// The first attempt failed its lookup, a later one went through.
|
||||
expect(warn).toHaveBeenCalledWith(
|
||||
'[realtime] credential lookup failed',
|
||||
expect.objectContaining({ message: 'auth store unavailable' }),
|
||||
);
|
||||
expect(log.count('reconnecting')).toBe(1);
|
||||
conversation.sendText('Still there?');
|
||||
await log.until(() => log.count('turn.done') === 1);
|
||||
|
||||
Reference in new issue
Block a user