mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
refactor websocket layer
This commit is contained in:
parent
4f68190a25
commit
f0c3581d26
9 changed files with 87 additions and 142 deletions
|
|
@ -91,11 +91,14 @@ describe('ProtobufService', () => {
|
|||
expect(mockSocket.send).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not send when socket is not OPEN', () => {
|
||||
it('does not register callback or increment cmdId when transport is closed', () => {
|
||||
const service = new ProtobufService(mockSocket);
|
||||
mockSocket.isOpen.mockReturnValue(false);
|
||||
service.sendCommand(create(Data.CommandContainerSchema), vi.fn());
|
||||
const cb = vi.fn();
|
||||
service.sendCommand(create(Data.CommandContainerSchema), cb);
|
||||
expect(mockSocket.send).not.toHaveBeenCalled();
|
||||
expect((service as ProtobufInternal).cmdId).toBe(0);
|
||||
expect((service as ProtobufInternal).pendingCommands.size).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue