Use constants for tests

This commit is contained in:
Raul Ochoa 2016-10-12 18:44:46 +02:00
parent f7d1f9426c
commit aa68dff24b
2 changed files with 5 additions and 3 deletions

View File

@ -1,3 +1,4 @@
var Channel = require('../../../batch/pubsub/channel');
var JobPublisher = require('../../../batch/pubsub/job-publisher');
var assert = require('assert');
@ -10,7 +11,7 @@ describe('batch API job publisher', function () {
return this;
},
publish: function () {
var isValidFirstArg = arguments[0] === 'batch:hosts';
var isValidFirstArg = arguments[0] === Channel.NAME;
var isValidSecondArg = arguments[1] === self.host;
self.redis.publishIsCalledWithValidArgs = isValidFirstArg && isValidSecondArg;
},

View File

@ -1,3 +1,4 @@
var Channel = require('../../../batch/pubsub/channel');
var JobSubscriber = require('../../../batch/pubsub/job-subscriber');
var assert = require('assert');
@ -11,7 +12,7 @@ describe('batch API job subscriber', function () {
return this;
},
subscribe: function () {
var isValidFirstArg = arguments[0] === 'batch:hosts';
var isValidFirstArg = arguments[0] === Channel.NAME;
self.redis.subscribeIsCalledWithValidArgs = isValidFirstArg;
},
on: function () {
@ -20,7 +21,7 @@ describe('batch API job subscriber', function () {
}
},
unsubscribe: function () {
var isValidFirstArg = arguments[0] === 'batch:hosts';
var isValidFirstArg = arguments[0] === Channel.NAME;
self.redis.unsubscribeIsCalledWithValidArgs = isValidFirstArg;
},
scan: function(params, callback) {