Skip to content

Commit

Permalink
[ADD] Added test to verify that error/close is getting called on dupl…
Browse files Browse the repository at this point in the history
…icate client id
  • Loading branch information
Alberto Ricart committed Oct 19, 2016
1 parent 5f9f81f commit 9d36921
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/basics.js
Expand Up @@ -127,6 +127,27 @@ describe('Basics', function () {
});
});

it('duplicate client id should fire error', function (done) {
var wantTwo = 2;
var id = nuid.next();
var stan = STAN.connect(cluster, id, PORT);
stan.on('connect', function () {
var stan2 = STAN.connect(cluster, id, PORT);
stan2.on('error', function() {
wantTwo--;
if (wantTwo === 0) {
done();
}
});
stan2.on('close', function() {
wantTwo--;
if (wantTwo === 0) {
done();
}
});
});
});

it('should include the correct message in the callback', function (done) {
var stan = STAN.connect(cluster, nuid.next(), PORT);
stan.on('connect', function () {
Expand Down

0 comments on commit 9d36921

Please sign in to comment.