Files
kami-parse-server/spec/RedisPubSub.spec.js

30 lines
883 B
JavaScript
Raw Normal View History

const RedisPubSub = require('../lib/Adapters/PubSub/RedisPubSub').RedisPubSub;
2016-03-10 14:27:00 -08:00
describe('RedisPubSub', function() {
beforeEach(function(done) {
// Mock redis
const createClient = jasmine.createSpy('createClient');
2016-03-10 14:27:00 -08:00
jasmine.mockLibrary('redis', 'createClient', createClient);
done();
});
it('can create publisher', function() {
RedisPubSub.createPublisher({redisURL: 'redisAddress'});
2016-03-10 14:27:00 -08:00
const redis = require('redis');
2016-03-10 14:27:00 -08:00
expect(redis.createClient).toHaveBeenCalledWith('redisAddress', { no_ready_check: true });
});
it('can create subscriber', function() {
RedisPubSub.createSubscriber({redisURL: 'redisAddress'});
2016-03-10 14:27:00 -08:00
const redis = require('redis');
2016-03-10 14:27:00 -08:00
expect(redis.createClient).toHaveBeenCalledWith('redisAddress', { no_ready_check: true });
});
afterEach(function() {
jasmine.restoreLibrary('redis', 'createClient');
});
});