Skip to content

Commit

Permalink
Elimiate count variable
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Jul 16, 2019
1 parent 56bf465 commit d3cbca7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/qos1.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,8 @@ test('not clean and retain messages with QoS 1', function (t) {
})

test('subscribe and publish QoS 1 in parallel', function (t) {
t.plan(5)

var broker = aedes()
var s = connect(setup(broker))
var expected = {
Expand All @@ -686,7 +688,6 @@ 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 @@ -698,22 +699,17 @@ test('subscribe and publish QoS 1 in parallel', function (t) {
t.equal(packet.messageId, 42, 'messageId must match')
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 d3cbca7

Please sign in to comment.