fix(tests): Remove redundant manual topic handlers from tests and rely on server built-in pub/sub

This commit is contained in:
2025-08-29 08:49:04 +00:00
parent 350b3f1359
commit 6c77ca1e4c
3 changed files with 16 additions and 13 deletions

View File

@@ -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!' });