Skip to content

Commit f932215

Browse files
committed
Added test for subscriptions with individual QoS levels
1 parent 257c521 commit f932215

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/abstract_client.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,34 @@ module.exports = function(server, createClient, port) {
538538
});
539539
});
540540

541+
it('should accept an hash of subscriptions', function(done) {
542+
var client = createClient(port);
543+
544+
var topics = {'test1': 0, 'test2': 1}
545+
546+
client.once('connect', function() {
547+
client.subscribe(topics);
548+
});
549+
550+
server.once('client', function(client) {
551+
client.once('subscribe', function(packet) {
552+
var expected = [];
553+
554+
for (var k in topics) {
555+
if (topics.hasOwnProperty(k)) {
556+
expected.push({
557+
topic: k,
558+
qos: topics[k]
559+
});
560+
}
561+
}
562+
563+
packet.subscriptions.should.eql(expected);
564+
done();
565+
});
566+
});
567+
});
568+
541569
it('should accept an options parameter', function(done) {
542570
var client = createClient(port);
543571

0 commit comments

Comments
 (0)