fix(prettier): Properly handle lint-stage files (#6970)
Now handles top level files and recursive files in folders. Set max line length to be 100
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
const Subscription = require('../lib/LiveQuery/Subscription').Subscription;
|
||||
let logger;
|
||||
describe('Subscription', function() {
|
||||
beforeEach(function() {
|
||||
describe('Subscription', function () {
|
||||
beforeEach(function () {
|
||||
logger = require('../lib/logger').logger;
|
||||
spyOn(logger, 'error').and.callThrough();
|
||||
});
|
||||
|
||||
it('can be initialized', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can be initialized', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
|
||||
expect(subscription.className).toBe('className');
|
||||
expect(subscription.query).toEqual({ key: 'value' });
|
||||
@@ -19,45 +15,29 @@ describe('Subscription', function() {
|
||||
expect(subscription.clientRequestIds.size).toBe(0);
|
||||
});
|
||||
|
||||
it('can check it has subscribing clients', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can check it has subscribing clients', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
|
||||
expect(subscription.hasSubscribingClient()).toBe(false);
|
||||
});
|
||||
|
||||
it('can check it does not have subscribing clients', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can check it does not have subscribing clients', function () {
|
||||
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() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can add one request for one client', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
|
||||
expect(subscription.clientRequestIds.size).toBe(1);
|
||||
expect(subscription.clientRequestIds.get(1)).toEqual([1]);
|
||||
});
|
||||
|
||||
it('can add requests for one client', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can add requests for one client', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
|
||||
@@ -65,12 +45,8 @@ describe('Subscription', function() {
|
||||
expect(subscription.clientRequestIds.get(1)).toEqual([1, 2]);
|
||||
});
|
||||
|
||||
it('can add requests for clients', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can add requests for clients', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
subscription.addClientSubscription(2, 2);
|
||||
@@ -81,23 +57,15 @@ describe('Subscription', function() {
|
||||
expect(subscription.clientRequestIds.get(2)).toEqual([2, 3]);
|
||||
});
|
||||
|
||||
it('can delete requests for nonexistent client', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can delete requests for nonexistent client', function () {
|
||||
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() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can delete nonexistent request for one client', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.deleteClientSubscription(1, 2);
|
||||
|
||||
@@ -106,12 +74,8 @@ describe('Subscription', function() {
|
||||
expect(subscription.clientRequestIds.get(1)).toEqual([1]);
|
||||
});
|
||||
|
||||
it('can delete some requests for one client', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can delete some requests for one client', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
subscription.deleteClientSubscription(1, 2);
|
||||
@@ -121,12 +85,8 @@ describe('Subscription', function() {
|
||||
expect(subscription.clientRequestIds.get(1)).toEqual([1]);
|
||||
});
|
||||
|
||||
it('can delete all requests for one client', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can delete all requests for one client', function () {
|
||||
const subscription = new Subscription('className', { key: 'value' }, 'hash');
|
||||
subscription.addClientSubscription(1, 1);
|
||||
subscription.addClientSubscription(1, 2);
|
||||
subscription.deleteClientSubscription(1, 1);
|
||||
@@ -136,12 +96,8 @@ describe('Subscription', function() {
|
||||
expect(subscription.clientRequestIds.size).toBe(0);
|
||||
});
|
||||
|
||||
it('can delete requests for multiple clients', function() {
|
||||
const subscription = new Subscription(
|
||||
'className',
|
||||
{ key: 'value' },
|
||||
'hash'
|
||||
);
|
||||
it('can delete requests for multiple clients', function () {
|
||||
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