fix: add regression test

This commit is contained in:
Renan Castro
2024-01-18 22:47:31 -03:00
parent 913687cbd2
commit 9e0990ee87

View File

@@ -350,6 +350,21 @@ Meteor.methods({
},
});
Meteor.publish("livedata_server_test_sub_chain", async function () {
await new Promise(r => setTimeout(r, 2000));
this.ready();
return null;
});
Tinytest.addAsync("livedata server - waiting for subscription chain", (test, onComplete) => makeTestConnection(test, async (clientConn, serverConn) => {
const handlers = [];
for(let i=0; i< 10; i++){
handlers.push(clientConn.subscribe('livedata_server_test_sub_chain'));
}
await new Promise(r => setTimeout(r, 3000));
test.equal(handlers.map(sub => sub.ready()).filter(o=>o).length === 1, true);
onComplete();
}));
Tinytest.addAsync("livedata server - waiting for Promise", (test, onComplete) =>
makeTestConnection(test, async (clientConn, serverConn) => {
const testResolvedPromiseResult = await clientConn.callAsync(