()
| 54 | type MockCall = [string, ...unknown[]] |
| 55 | |
| 56 | function getMessageHandler(): |
| 57 | | ((msg: Buffer, rinfo: { address: string; port: number }) => void) |
| 58 | | undefined { |
| 59 | const calls = mockSocket.on.mock.calls as unknown as MockCall[] |
| 60 | const call = calls.find(c => c[0] === 'message') |
| 61 | return call?.[1] as |
| 62 | | ((msg: Buffer, rinfo: { address: string; port: number }) => void) |
| 63 | | undefined |
| 64 | } |
| 65 | |
| 66 | describe('LanBeacon', () => { |
| 67 | let beacon: InstanceType<typeof LanBeacon> |