Skip to content

Commit

Permalink
Merge 49f305c into a1c5b40
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Jul 16, 2019
2 parents a1c5b40 + 49f305c commit 4303f72
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions test/qos1.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ test('subscribe and publish QoS 1 in parallel', function (t) {
length: 14,
retain: false
}
var count = 0

broker.on('clientError', function (client, err) {
console.log(err.stack)
Expand All @@ -695,19 +696,24 @@ test('subscribe and publish QoS 1 in parallel', function (t) {
s.outStream.once('data', function (packet) {
t.equal(packet.cmd, 'puback')
t.equal(packet.messageId, 42, 'messageId must match')
s.outStream.once('data', function (packet) {
s.inStream.write({
cmd: 'puback',
messageId: packet.messageId
})
delete packet.messageId
t.deepEqual(packet, expected, 'packet must match')
s.outStream.once('data', function (packet) {
t.equal(packet.cmd, 'suback')
s.outStream.on('data', function (packet) {
if (packet.cmd === 'suback') {
count++
t.deepEqual(packet.granted, [1])
t.equal(packet.messageId, 24)
}
if (packet.cmd === 'publish') {
count++
s.inStream.write({
cmd: 'puback',
messageId: packet.messageId
})
delete packet.messageId
t.deepEqual(packet, expected, 'packet must match')
}
if (count === 2) {
t.end()
})
}
})
})

Expand Down

0 comments on commit 4303f72

Please sign in to comment.