From 9bac5ebbcc0d718a4d776ae5f5846dd38d82fd4c Mon Sep 17 00:00:00 2001 From: Gnought <1684105+gnought@users.noreply.github.com> Date: Fri, 19 Jul 2019 22:19:29 +0800 Subject: [PATCH] Enhance auth QoS 0 tests (#272) --- test/auth.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/auth.js b/test/auth.js index cd198f70..869cd30d 100644 --- a/test/auth.js +++ b/test/auth.js @@ -310,7 +310,7 @@ test('authentication error when non numeric return code is passed', function (t) }) test('authorize publish', function (t) { - t.plan(3) + t.plan(4) var s = connect(setup()) var expected = { @@ -330,6 +330,7 @@ test('authorize publish', function (t) { } s.broker.mq.on('hello', function (packet, cb) { + t.notOk(Object.prototype.hasOwnProperty.call(packet, 'messageId'), 'should not contain messageId in QoS 0') expected.brokerId = s.broker.id expected.brokerCounter = s.broker.counter delete expected.dup @@ -346,7 +347,7 @@ test('authorize publish', function (t) { }) test('authorize waits for authenticate', function (t) { - t.plan(5) + t.plan(6) var s = setup() @@ -376,6 +377,7 @@ test('authorize waits for authenticate', function (t) { } s.broker.mq.on('hello', function (packet, cb) { + t.notOk(Object.prototype.hasOwnProperty.call(packet, 'messageId'), 'should not contain messageId in QoS 0') expected.brokerId = s.broker.id expected.brokerCounter = s.broker.counter delete expected.dup @@ -403,7 +405,7 @@ test('authorize waits for authenticate', function (t) { }) test('authorize publish from configOptions', function (t) { - t.plan(3) + t.plan(4) var s = connect(setup(aedes({ authorizePublish: function (client, packet, cb) { @@ -424,6 +426,7 @@ test('authorize publish from configOptions', function (t) { } s.broker.mq.on('hello', function (packet, cb) { + t.notOk(Object.prototype.hasOwnProperty.call(packet, 'messageId'), 'should not contain messageId in QoS 0') expected.brokerId = s.broker.id expected.brokerCounter = s.broker.counter delete expected.dup