Resolve "Transition to ESLint"

This commit is contained in:
Thea Schöbl
2022-06-27 14:40:09 +00:00
committed by Rainer Killinger
parent ca1d2444e0
commit 418ba67d15
47 changed files with 1854 additions and 1634 deletions

View File

@@ -15,6 +15,7 @@
*/
import {SCBulkRequest, SCThingType} from '@openstapps/core';
import moment from 'moment';
// eslint-disable-next-line unicorn/import-style
import util from 'util';
import {configFile} from '../../src/common';
import {Bulk, BulkStorage} from '../../src/storage/bulk-storage';
@@ -72,7 +73,7 @@ describe('Bulk Storage', function () {
expect(esMock.calledWith(bulk)).to.be.true;
});
it('should not call appropriate database clean-up method on expire if bulk\'s state is done', async function () {
it("should not call appropriate database clean-up method on expire if bulk's state is done", async function () {
bulk.state = 'done';
sandbox.stub(NodeCache.prototype, 'on').withArgs('expired', sinon.match.any).yields(123, bulk);
new BulkStorage(database);
@@ -88,11 +89,17 @@ describe('Bulk Storage', function () {
});
it('should delete a bulk', async function () {
const readStub = sandbox.stub(BulkStorage.prototype, 'read').callsFake(() => bulk);
const readStub = sandbox.stub(BulkStorage.prototype, 'read').callsFake(() => bulk);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let caught: any;
sandbox.stub(NodeCache.prototype, 'del').callsFake(() => caught = 123);
sandbox.stub(NodeCache.prototype, 'del').callsFake(() => (caught = 123));
// force call
sandbox.stub(util, 'promisify').callsFake(() => () => {}).yields(null);
sandbox
.stub(util, 'promisify')
// eslint-disable-next-line @typescript-eslint/no-empty-function,unicorn/consistent-function-scoping
.callsFake(() => () => {})
// eslint-disable-next-line unicorn/no-null
.yields(null);
const bulkStorage = new BulkStorage(database);
await bulkStorage.delete(bulk.uid);
@@ -103,15 +110,22 @@ describe('Bulk Storage', function () {
});
it('should read an existing bulk', async function () {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let caught: any;
sandbox.stub(NodeCache.prototype, 'get').callsFake(() => caught = 123);
sandbox.stub(NodeCache.prototype, 'get').callsFake(() => (caught = 123));
// force call
sandbox.stub(util, 'promisify').callsFake(() => () => {}).yields(null);
sandbox
.stub(util, 'promisify')
// eslint-disable-next-line unicorn/consistent-function-scoping,@typescript-eslint/no-empty-function
.callsFake(() => () => {})
// eslint-disable-next-line unicorn/no-null
.yields(null);
const bulkStorage = new BulkStorage(database);
await bulkStorage.read(bulk.uid);
expect(caught).to.be.equal(123);
});``
});
``;
});
});