chore(package): update jasmine to version 3.0.0 (#4553)
* 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
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
var Subscription = require('../src/LiveQuery/Subscription').Subscription;
|
||||
const Subscription = require('../src/LiveQuery/Subscription').Subscription;
|
||||
let logger;
|
||||
describe('Subscription', function() {
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can be initialized', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
|
||||
expect(subscription.className).toBe('className');
|
||||
expect(subscription.query).toEqual({ key : 'value' });
|
||||
@@ -17,20 +17,20 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can check it has subscribing clients', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
|
||||
expect(subscription.hasSubscribingClient()).toBe(false);
|
||||
});
|
||||
|
||||
it('can check it does not have subscribing clients', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
|
||||
expect(subscription.hasSubscribingClient()).toBe(true);
|
||||
});
|
||||
|
||||
it('can add one request for one client', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
|
||||
expect(subscription.clientRequestIds.size).toBe(1);
|
||||
@@ -38,7 +38,7 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can add requests for one client', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
|
||||
@@ -47,7 +47,7 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can add requests for clients', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
subscription.addClientSubscription(2, 2);
|
||||
@@ -59,14 +59,14 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can delete requests for nonexistent client', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.deleteClientSubscription(1, 1);
|
||||
|
||||
expect(logger.error).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('can delete nonexistent request for one client', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.deleteClientSubscription(1, 2);
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can delete some requests for one client', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
subscription.deleteClientSubscription(1, 2);
|
||||
@@ -87,7 +87,7 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can delete all requests for one client', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
subscription.deleteClientSubscription(1, 1);
|
||||
@@ -98,7 +98,7 @@ describe('Subscription', function() {
|
||||
});
|
||||
|
||||
it('can delete requests for multiple clients', function() {
|
||||
var subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
const subscription = new Subscription('className', { key : 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
subscription.addClientSubscription(2, 1);
|
||||
|
||||
Reference in New Issue
Block a user