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

33 lines
908 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');
expect(redis.createClient).toHaveBeenCalledWith('redisAddress', {
no_ready_check: true,
});
2016-03-10 14:27:00 -08:00
});
it('can create subscriber', function() {
RedisPubSub.createSubscriber({ redisURL: 'redisAddress' });
2016-03-10 14:27:00 -08:00
const redis = require('redis');
expect(redis.createClient).toHaveBeenCalledWith('redisAddress', {
no_ready_check: true,
});
2016-03-10 14:27:00 -08:00
});
afterEach(function() {
jasmine.restoreLibrary('redis', 'createClient');
});
});