This commit is contained in:
ChK
2026-04-04 08:34:16 +02:00
parent e90f044a30
commit 5fea87712c
5 changed files with 700 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ test('Connect to WS', ()=> {
//w = new WebSocket("ws://localhost:9991")
console.log(p.sockets)
//console.log(p.sockets)
p.server.close();
})

View File

@@ -146,7 +146,25 @@ describe('Robot.sendCommand & cmdReceivers', () => {
expect(r.callCount).toBe(1)
expect(logSpy).toHaveBeenCalled(1)
//expect(logSpy).toHaveBeenCalled(2)
logSpy.mockRestore()
})
test('sendCommand multiple Receivers', () => {
const logSpy = jest.spyOn(console, 'log').mockImplementation(() => {})
const r = new MockCmdReceiver()
robot.cmdReceivers.push(r)
const r2 = new MockCmdReceiver()
robot.cmdReceivers.push(r2)
robot.sendCommand()
expect(r.callCount).toBe(1)
expect(r2.callCount).toBe(1)
//console.log(logSpy)
//expect(logSpy).toHaveBeenCalled(2)
logSpy.mockRestore()
})