Skip to content

Node.js based forum software built for the modern web

add reset to pubsub for tests

Barış Soner Uşaklı1024a0efa1f9
diff --git a/src/pubsub.js b/src/pubsub.js
index e67fc87fc9..6f2af3dae8 100644
--- a/src/pubsub.js
+++ b/src/pubsub.js
@@ -52,4 +52,7 @@ module.exports = {
removeAllListeners: function (event) {
get().removeAllListeners(event);
},
+ reset: function () {
+ real = null;
+ },
};
diff --git a/test/pubsub.js b/test/pubsub.js
index 12d31f9ceb..83e551fece 100644
--- a/test/pubsub.js
+++ b/test/pubsub.js
@@ -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');