mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +00:00
Resolve "Transition to ESLint"
This commit is contained in:
committed by
Rainer Killinger
parent
ca1d2444e0
commit
418ba67d15
@@ -22,7 +22,6 @@ import sinon from 'sinon';
|
||||
|
||||
describe('Backend transport', function () {
|
||||
describe('isTransportWithVerification', function () {
|
||||
|
||||
it('should return false if transport is not verifiable', function () {
|
||||
expect(isTransportWithVerification({} as Transport)).to.be.false;
|
||||
expect(isTransportWithVerification({verify: 'foo'} as unknown as Transport)).to.be.false;
|
||||
@@ -30,6 +29,7 @@ describe('Backend transport', function () {
|
||||
|
||||
it('should return true if transport is verifiable', function () {
|
||||
// a transport which has verify function should be verifiable
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
expect(isTransportWithVerification({verify: () => {}} as unknown as Transport)).to.be.true;
|
||||
});
|
||||
});
|
||||
@@ -43,7 +43,7 @@ describe('Backend transport', function () {
|
||||
});
|
||||
|
||||
it('should provide only one instance of the transport', function () {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error not assignable
|
||||
sandbox.stub(SMTP, 'getInstance').callsFake(() => {
|
||||
return {};
|
||||
});
|
||||
@@ -77,8 +77,10 @@ describe('Backend transport', function () {
|
||||
});
|
||||
|
||||
it('should provide information that the transport if waiting for its verification', function () {
|
||||
// @ts-ignore
|
||||
sandbox.stub(SMTP, 'getInstance').callsFake(() => {return {verify: () => Promise.resolve(true)}});
|
||||
// @ts-expect-error not assignable
|
||||
sandbox.stub(SMTP, 'getInstance').callsFake(() => {
|
||||
return {verify: () => Promise.resolve(true)};
|
||||
});
|
||||
|
||||
expect(BackendTransport.getInstance().isWaitingForVerification()).to.be.true;
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/*
|
||||
* Copyright (C) 2020 StApps
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -37,7 +38,7 @@ describe('MailQueue', async function () {
|
||||
it('should fail after maximal number of verification checks', function () {
|
||||
const loggerStub = sandbox.spy(Logger, 'warn');
|
||||
const test = () => {
|
||||
// @ts-ignore
|
||||
// @ts-expect-error not assignable
|
||||
new MailQueue(getTransport(false));
|
||||
// fake that VERIFICATION_TIMEOUT was reached more times (one more) than MAX_VERIFICATION_ATTEMPTS
|
||||
clock.tick(MailQueue.VERIFICATION_TIMEOUT * (MailQueue.MAX_VERIFICATION_ATTEMPTS + 1));
|
||||
@@ -50,8 +51,8 @@ describe('MailQueue', async function () {
|
||||
it('should add queued mails to the queue for sending when transport is verified', async function () {
|
||||
const queueAddStub = sandbox.stub(Queue.prototype, 'add');
|
||||
const numberOfMails = 3;
|
||||
let transport = getTransport(false);
|
||||
// @ts-ignore
|
||||
const transport = getTransport(false);
|
||||
// @ts-expect-error not assignable
|
||||
const mailQueue = new MailQueue(transport);
|
||||
const mail: MailOptions = {from: 'Foo', subject: 'Foo Subject'};
|
||||
for (let i = 0; i < numberOfMails; i++) {
|
||||
@@ -67,7 +68,7 @@ describe('MailQueue', async function () {
|
||||
|
||||
it('should not add SMTP sending tasks to queue when transport is not verified', function () {
|
||||
const queueAddStub = sandbox.stub(Queue.prototype, 'add');
|
||||
// @ts-ignore
|
||||
// @ts-expect-error not assignable
|
||||
const mailQueue = new MailQueue(getTransport(false));
|
||||
const mail: MailOptions = {};
|
||||
mailQueue.push(mail);
|
||||
@@ -77,8 +78,8 @@ describe('MailQueue', async function () {
|
||||
|
||||
it('should add SMTP sending tasks to queue when transport is verified', function () {
|
||||
const queueAddStub = sandbox.stub(Queue.prototype, 'add');
|
||||
let transport = getTransport(false);
|
||||
// @ts-ignore
|
||||
const transport = getTransport(false);
|
||||
// @ts-expect-error not assignable
|
||||
const mailQueue = new MailQueue(transport);
|
||||
const mail: MailOptions = {from: 'Foo', subject: 'Foo Subject'};
|
||||
// fake that transport is verified
|
||||
@@ -90,11 +91,11 @@ describe('MailQueue', async function () {
|
||||
|
||||
it('should send SMTP mails when transport is verified', async function () {
|
||||
let caught: any;
|
||||
sandbox.stub(Queue.prototype, 'add').callsFake(async (promiseGenerator) => {
|
||||
sandbox.stub(Queue.prototype, 'add').callsFake(async promiseGenerator => {
|
||||
caught = await promiseGenerator();
|
||||
});
|
||||
let transport = getTransport(false);
|
||||
// @ts-ignore
|
||||
const transport = getTransport(false);
|
||||
// @ts-expect-error not assignable
|
||||
const mailQueue = new MailQueue(transport);
|
||||
const mail: MailOptions = {from: 'Foo', subject: 'Foo Subject'};
|
||||
// fake that transport is verified
|
||||
|
||||
Reference in New Issue
Block a user