Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 13:30 UTC
test(core): model asynchronous Pusher dispatch
CoralGarden52 committed
Sep 11, 2026 at 15:38 UTC
d5bc9253c9cec454cbd77e63c61992de68e23be5
1 file changed
+11
-5
ts/packages/core/test/services/pusher.test.ts
+11
-5
@@ -19,8 +19,8 @@ const { bindings, mockChannel, mockPusherClient, mockGetCredentials, mockLoggerE
19
bindings: eventBindings,
20
mockChannel: channel,
21
mockPusherClient: {
22
- subscribe: vi.fn().mockResolvedValue(channel),
23
- unsubscribe: vi.fn().mockResolvedValue(undefined),
22
+ subscribe: vi.fn().mockReturnValue(channel),
23
+ unsubscribe: vi.fn().mockReturnValue(undefined),
24
},
25
mockGetCredentials: vi.fn().mockResolvedValue({
26
projectId: 'project-id',
@@ -70,9 +70,15 @@ describe('PusherService subscription errors', () => {
70
71
await service.subscribe(vi.fn());
72
73
- expect(() => {
74
- mockChannel.emit('pusher:subscription_error', { error: 401 });
75
- }).not.toThrow();
73
+ await new Promise<void>(resolve => {
74
+ setImmediate(() => {
75
+ expect(() => {
76
+ mockChannel.emit('pusher:subscription_error', { error: 401 });
77
+ }).not.toThrow();
78
+ resolve();
79
+ });
80
+ });
81
+
82
expect(mockLoggerError).toHaveBeenCalledWith(
83
expect.stringContaining('Trigger subscription error: 401')
84
);