Skip to content

Commit

Permalink
Merge pull request #26 from behrad/master
Browse files Browse the repository at this point in the history
add test for concurrent subscriptions & update qlobber
  • Loading branch information
mcollina authored Nov 20, 2018
2 parents b877c90 + 1672a68 commit 93d7927
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
node_js:
- "4"
- "6"
- "7"
- "8"
- "10"
32 changes: 32 additions & 0 deletions abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,38 @@ function abstractPersistence (opts) {
})
})

testInstance('get topic list after concurrent subscriptions of a client', function (t, instance) {
var client = { id: 'abcde' }
var subs1 = [{
topic: 'hello1',
qos: 1
}]
var subs2 = [{
topic: 'hello2',
qos: 1
}]
var calls = 2

function done () {
if (!--calls) {
instance.subscriptionsByClient(client, function (err, resubs) {
t.notOk(err, 'no error')
t.deepEqual(resubs, [subs1[0], subs2[0]])
instance.destroy(t.end.bind(t))
})
}
}

instance.addSubscriptions(client, subs1, function (err) {
t.notOk(err, 'no error for hello1')
done()
})
instance.addSubscriptions(client, subs2, function (err) {
t.notOk(err, 'no error for hello2')
done()
})
})

testInstance('add outgoing packet and stream it', function (t, instance) {
var sub = {
clientId: 'abcde',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"aedes-packet": "^1.0.0",
"from2": "^2.1.0",
"qlobber": "^1.8.0",
"qlobber": "^3.0.2",
"safe-buffer": "^5.0.1"
}
}

0 comments on commit 93d7927

Please sign in to comment.