fix(core): update

This commit is contained in:
2022-01-19 07:01:58 +01:00
parent 6fdf0d9955
commit 489ad9284b
10 changed files with 68 additions and 53 deletions

View File

@ -105,12 +105,13 @@ tap.test('should be able to tag a connection from client', async (tools) => {
tap.test('should be able to tag a connection from server', async (tools) => {
await testSmartsocket.socketConnections
.findSync((socketConnection) => {
return true;
}).addTag({
id: 'awesome2',
payload: 'absolutely',
});
.findSync((socketConnection) => {
return true;
})
.addTag({
id: 'awesome2',
payload: 'absolutely',
});
const tagOnClientSide = await testSmartsocketClient.socketConnection.getTagById('awesome2');
expect(tagOnClientSide.payload).to.equal('absolutely');
});
@ -143,10 +144,19 @@ tap.test('should be able to make a functionCall from server to client', async ()
tap.test('client should disconnect and reconnect', async (tools) => {
await testSmartsocketClient.disconnect();
await tools.delayFor(100);
await testSmartsocketClient.connect();
});
tap.test('should be able to locate a connection tag after reconnect', async (tools) => {
console.log(testSmartsocket.socketConnections.getArray().length);
const tagOnServerSide = await testSmartsocket.socketConnections
.findSync((socketConnection) => {
return true;
})
.getTagById('awesome');
expect(tagOnServerSide.payload).to.equal('yes');
});
// terminate
tap.test('should close the server', async () => {
await testSmartsocket.stop();