add reset to pubsub for tests

This commit is contained in:
Barış Soner Uşaklı
2018-10-13 18:20:58 -04:00
parent 7d8fc09226
commit 1024a0efa1
2 changed files with 9 additions and 0 deletions

View File

@@ -52,4 +52,7 @@ module.exports = {
removeAllListeners: function (event) {
get().removeAllListeners(event);
},
reset: function () {
real = null;
},
};

View File

@@ -7,6 +7,12 @@ var db = require('./mocks/databasemock');
var pubsub = require('../src/pubsub');
describe('pubsub', function () {
beforeEach(function () {
pubsub.reset();
});
afterEach(function () {
pubsub.reset();
});
it('should use singleHostCluster', function (done) {
var oldValue = nconf.get('singleHostCluster');
var isCluster = nconf.get('isCluster');