Add LiveQuery

This commit is contained in:
wangmengyan95
2016-03-10 14:27:00 -08:00
parent cf3606246f
commit 555e25bf33
33 changed files with 3580 additions and 48 deletions

29
spec/RedisPubSub.spec.js Normal file
View File

@@ -0,0 +1,29 @@
var RedisPubSub = require('../src/LiveQuery/RedisPubSub').RedisPubSub;
describe('RedisPubSub', function() {
beforeEach(function(done) {
// Mock redis
var createClient = jasmine.createSpy('createClient');
jasmine.mockLibrary('redis', 'createClient', createClient);
done();
});
it('can create publisher', function() {
var publisher = RedisPubSub.createPublisher('redisAddress');
var redis = require('redis');
expect(redis.createClient).toHaveBeenCalledWith('redisAddress', { no_ready_check: true });
});
it('can create subscriber', function() {
var subscriber = RedisPubSub.createSubscriber('redisAddress');
var redis = require('redis');
expect(redis.createClient).toHaveBeenCalledWith('redisAddress', { no_ready_check: true });
});
afterEach(function() {
jasmine.restoreLibrary('redis', 'createClient');
});
});