fix(tests): Remove redundant manual topic handlers from tests and rely on server built-in pub/sub
This commit is contained in:
11
test/test.ts
11
test/test.ts
@@ -161,17 +161,6 @@ tap.test('should handle pub/sub pattern', async () => {
|
||||
messageReceived.resolve();
|
||||
});
|
||||
|
||||
// Server handles the subscription
|
||||
server.onMessage('__subscribe__', async (payload, clientId) => {
|
||||
expect(payload.topic).toEqual('news');
|
||||
});
|
||||
|
||||
// Server handles publishing
|
||||
server.onMessage('__publish__', async (payload, clientId) => {
|
||||
// Broadcast to all subscribers of the topic
|
||||
await server.broadcast(`topic:${payload.topic}`, payload.payload);
|
||||
});
|
||||
|
||||
// Client 2 publishes to the topic
|
||||
await client2.publish('news', { headline: 'Breaking news!' });
|
||||
|
||||
|
Reference in New Issue
Block a user