Files
kami-parse-server/spec/RedisPubSub.spec.js
Florent Vilmart ae1a8226d5 Removes need to use babel-register (#4865)
* Removes need to use babel-register

- Adds watch to watch changes when running the test to regenerate
- Tests are now pure node 8

* Adds timing to helper.js

* Update contribution guide

* Adds inline sourcemaps generation to restore coverage

* nits
2018-07-02 23:30:14 -04:00

30 lines
883 B
JavaScript

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