Skip to content

Commit

Permalink
Fixed test that subscription happen after retained
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Jul 23, 2019
1 parent f0f50db commit 84971ff
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/retain.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,20 @@ test('new QoS 0 subscribers receive downgraded QoS 1 retained messages when clea
retain: true,
messageId: 42
})
var subscriber = connect(setup(broker, false), { clean: true })
subscribe(t, subscriber, 'hello', 0, function () {
subscriber.outStream.on('data', function (packet) {
t.notEqual(packet.messageId, 42, 'messageId should not be the same')
delete packet.messageId
t.deepEqual(packet, expected, 'packet must match')
t.equal(broker.counter, 4)
t.end()
publisher.outStream.on('data', function (packet) {
var subscriber = connect(setup(broker, false), { clean: true })
subscribe(t, subscriber, 'hello', 0, function () {
subscriber.outStream.on('data', function (packet) {
t.notEqual(packet.messageId, 42, 'messageId should not be the same')
delete packet.messageId
t.deepEqual(packet, expected, 'packet must match')
})
})
})
broker.on('closed', function () {
t.equal(broker.counter, 6)
t.end()
})
})

// [MQTT-3.3.1-10]
Expand Down

0 comments on commit 84971ff

Please sign in to comment.