Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Add linter for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
onechiporenko committed Oct 4, 2021
1 parent 9e81626 commit 1ccaf87
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 17 deletions.
8 changes: 6 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:mocha-cleanup/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -31,6 +32,9 @@
{
"ignoreRestArgs": true
}
]
],
"mocha-cleanup/asserts-limit": 0,
"mocha-cleanup/complexity-it": 0,
"mocha-cleanup/no-outside-declaration": 0
}
}
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"coveralls": "^3.1.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-mocha-cleanup": "^1.10.0",
"eslint-plugin-prettier": "^4.0.0",
"istanbul": "^0.4.5",
"mocha": "^9.1.1",
Expand Down
2 changes: 1 addition & 1 deletion tests/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let factory;

describe('Factory', () => {
describe('#field', () => {
describe('should thrown an error if `value` does not exist in the `allowedValues`', () => {
it('should thrown an error if `value` does not exist in the `allowedValues`', () => {
expect(() =>
Factory.create({
attrs: {
Expand Down
28 changes: 14 additions & 14 deletions tests/single-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ describe('single record', () => {
expect(lair.getOne('b', '1').propA.map((c) => c.id)).to.be.eql(['1']);
});

describe('', () => {
describe('record is updated (relations are updated too)', () => {
beforeEach(() => {
lair.updateOne('a', '2', { propB: '1' });
});
Expand Down Expand Up @@ -643,7 +643,7 @@ describe('single record', () => {
expect(lair.getOne('b', '1').propA.map((c) => c.id)).to.be.eql(['1']);
});

describe('', () => {
describe('record is updated (relations are updated too)', () => {
beforeEach(() => {
lair.updateOne('a', '2', { propB: { id: '1' } });
});
Expand Down Expand Up @@ -710,7 +710,7 @@ describe('single record', () => {
]);
});

describe('', () => {
describe('one-to-one relation update (id is passed)', () => {
beforeEach(() => {
lair.updateOne('a', '1', { propB: '2' });
});
Expand Down Expand Up @@ -813,7 +813,7 @@ describe('single record', () => {
expect(lair.getOne('b', '1').propA.map((c) => c.id)).to.be.eql(['1']);
});

describe('', () => {
describe('one-to-one relation update (id is passed)', () => {
beforeEach(() => {
lair.createOne('a', { propB: '1' });
});
Expand Down Expand Up @@ -844,7 +844,7 @@ describe('single record', () => {
});
});

describe('should create relationships (object passed)', () => {
describe('should create relationships (object is passed)', () => {
beforeEach(() => {
lair.registerFactory(
Factory.create({
Expand All @@ -871,7 +871,7 @@ describe('single record', () => {
expect(lair.getOne('b', '1').propA.map((c) => c.id)).to.be.eql(['1']);
});

describe('', () => {
describe('one-to-one relation update (object passed)', () => {
beforeEach(() => {
lair.createOne('a', { propB: { id: '1' } });
});
Expand Down Expand Up @@ -1042,7 +1042,7 @@ describe('single record', () => {
expect(lair.getOne('b', '3').propA).to.be.null;
});

describe('', () => {
describe('one-to-many relation update (list of ids is passed)', () => {
beforeEach(() => {
lair.updateOne('a', '1', { propB: ['2', '3'] });
});
Expand Down Expand Up @@ -1114,7 +1114,7 @@ describe('single record', () => {
expect(lair.getOne('b', '3').propA).to.be.null;
});

describe('', () => {
describe('one-to-many relation update (list of object is passed)', () => {
beforeEach(() => {
lair.updateOne('a', '1', { propB: [{ id: '2' }, { id: '3' }] });
});
Expand Down Expand Up @@ -1200,7 +1200,7 @@ describe('single record', () => {
expect(lair.getOne('b', '3').propA).to.be.null;
});

describe('', () => {
describe('one-to-many relation update (list of ids is passed)', () => {
beforeEach(() => {
lair.createOne('a', { propB: ['2', '3'] });
});
Expand Down Expand Up @@ -1278,7 +1278,7 @@ describe('single record', () => {
expect(lair.getOne('b', '3').propA).to.be.null;
});

describe('', () => {
describe('one-to-many relation update (list of ids is passed)', () => {
beforeEach(() => {
lair.createOne('a', { propB: [{ id: '2' }, { id: '3' }] });
});
Expand Down Expand Up @@ -1465,7 +1465,7 @@ describe('single record', () => {
expect(lair.getOne('b', '4').propA.map((c) => c.id)).to.be.eql(['2']);
});

describe('', () => {
describe('one-to-many relation update (list of ids is passed)', () => {
beforeEach(() => {
lair.updateOne('a', '1', { propB: ['2', '3'] });
});
Expand Down Expand Up @@ -1562,7 +1562,7 @@ describe('single record', () => {
expect(lair.getOne('b', '4').propA.map((c) => c.id)).to.be.eql(['2']);
});

describe('', () => {
describe('one-to-many relation update (list of objects is passed)', () => {
beforeEach(() => {
lair.updateOne('a', '1', { propB: [{ id: '2' }, { id: '3' }] });
});
Expand Down Expand Up @@ -1675,7 +1675,7 @@ describe('single record', () => {
expect(lair.getOne('b', '5').propA.map((c) => c.id)).to.be.eql([]);
});

describe('', () => {
describe('one-to-many relation update (list of ids is passed)', () => {
beforeEach(() => {
lair.createOne('a', { propB: ['2', '3', '5'] });
});
Expand Down Expand Up @@ -1787,7 +1787,7 @@ describe('single record', () => {
expect(lair.getOne('b', '5').propA.map((c) => c.id)).to.be.eql([]);
});

describe('', () => {
describe('one-to-many relation update (list of objects is passed)', () => {
beforeEach(() => {
lair.createOne('a', {
propB: [{ id: '2' }, { id: '3' }, { id: '5' }],
Expand Down

0 comments on commit 1ccaf87

Please sign in to comment.