* chore(package): update jasmine to version 3.0.0 Closes #4547 * Fixes failing tests for jasmine 3.0 Starting 3.0, done(something) will fail * Update tests so they dont leverage var, but let and const With jasmine 3.0, the randomization engine was making the test fails because of the scope of `var` * Remove randomizer * Use same adapter for PG tests, drop table to ensure the tests dont side effect
30 lines
883 B
JavaScript
30 lines
883 B
JavaScript
const RedisPubSub = require('../src/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');
|
|
});
|
|
});
|