Skip to content

Commit

Permalink
test: show logs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximoLiberata committed Aug 3, 2024
1 parent 0e9edea commit 807d5e5
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/abstract_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,12 @@ export default function abstractTest(server, config, ports) {
let received = 0

client.on('packetreceive', (packet) => {
console.log('PACKETRECEIVE', {
reschedulePings,
callCount: spyReschedule.callCount,
received,
packet,
})
if (packet.cmd === 'puback') {
process.nextTick(() => {
clock.tick(intervalMs)
Expand Down Expand Up @@ -2163,13 +2169,24 @@ export default function abstractTest(server, config, ports) {
})

server.once('client', (serverClient) => {
serverClient.on('publish', () => {
serverClient.on('publish', (packet) => {
console.log('PUBLISH', {
reschedulePings,
callCount: spyReschedule.callCount,
received,
packet,
})
// needed to trigger the setImmediate inside server publish listener and send suback
clock.tick(1)
})
})

client.once('connect', () => {
console.log('CONNECT', {
reschedulePings,
callCount: spyReschedule.callCount,
received,
})
// reset call count (it's called also on connack)
spyReschedule.resetHistory()
// use qos1 so the puback is received (to reschedule ping)
Expand Down

0 comments on commit 807d5e5

Please sign in to comment.