Skip to content

Commit

Permalink
Merge cd7ea5c into d2aefc2
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 15, 2020
2 parents d2aefc2 + cd7ea5c commit 0b0f2a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/will.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,21 +325,25 @@ test('does not store multiple will with same clientid', function (t) {
var opts = { clientId: 'abcde' }

var broker = aedes()
var s = willConnect(setup(broker), opts, function () {

var s = willConnect(setup(broker, false), opts, function () {
// gracefully close client so no will is sent
s.inStream.end({
cmd: 'disconnect'
})
})

broker.on('clientDisconnect', function (c) {
// reconnect same client with will
s = willConnect(setup(broker), opts, function () {
s = willConnect(setup(broker, false), opts, function () {
// check that there are not 2 will messages for the same clientid
s.broker.persistence.delWill({ id: opts.clientId }, function (err, packet) {
t.error(err, 'no error')
t.equal(packet.clientId, opts.clientId, 'will packet found')
s.broker.persistence.delWill({ id: opts.clientId }, function (err, packet) {
t.error(err, 'no error')
t.equal(!!packet, false, 'no duplicated packets')
broker.close()
})
})
})
Expand Down

0 comments on commit 0b0f2a7

Please sign in to comment.