From 8867f06828ebc6f0fe9568451c4fa4bbde84c8c7 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 26 Mar 2021 10:38:58 +0100 Subject: [PATCH] TestApp: don't ignore commands by default --- src/TestApp.ts | 4 ++-- test/Authentication.test.ts | 2 +- test/AuthenticationNoUsername.test.ts | 2 +- test/CsrfProtectionComponent.test.ts | 2 +- test/_app.ts | 6 ++++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/TestApp.ts b/src/TestApp.ts index 34ad368..69abb29 100644 --- a/src/TestApp.ts +++ b/src/TestApp.ts @@ -50,8 +50,8 @@ export default class TestApp extends Application { private readonly addr: string; private readonly port: number; - public constructor(addr: string, port: number) { - super(packageJson.version, true); + public constructor(addr: string, port: number, ignoreCommandLine: boolean = false) { + super(packageJson.version, ignoreCommandLine); this.addr = addr; this.port = port; } diff --git a/test/Authentication.test.ts b/test/Authentication.test.ts index fff1ef0..6233458 100644 --- a/test/Authentication.test.ts +++ b/test/Authentication.test.ts @@ -34,7 +34,7 @@ useApp(async (addr, port) => { await super.init(); } - }(addr, port); + }(addr, port, true); }); let agent: supertest.SuperTest; diff --git a/test/AuthenticationNoUsername.test.ts b/test/AuthenticationNoUsername.test.ts index 8930d7d..ba7239d 100644 --- a/test/AuthenticationNoUsername.test.ts +++ b/test/AuthenticationNoUsername.test.ts @@ -37,7 +37,7 @@ useApp(async (addr, port) => { protected getMigrations(): MigrationType[] { return super.getMigrations().filter(m => m !== AddNameToUsersMigration); } - }(addr, port); + }(addr, port, true); }); let agent: supertest.SuperTest; diff --git a/test/CsrfProtectionComponent.test.ts b/test/CsrfProtectionComponent.test.ts index f83a5cb..1cc82f7 100644 --- a/test/CsrfProtectionComponent.test.ts +++ b/test/CsrfProtectionComponent.test.ts @@ -24,7 +24,7 @@ useApp(async (addr, port) => { await super.init(); } - }(addr, port); + }(addr, port, true); }); describe('Test CSRF protection', () => { diff --git a/test/_app.ts b/test/_app.ts index 643d66d..2992023 100644 --- a/test/_app.ts +++ b/test/_app.ts @@ -5,7 +5,7 @@ import MysqlConnectionManager from "../src/db/MysqlConnectionManager"; import config from "config"; -export default function useApp(appSupplier?: (addr: string, port: number) => Promise): void { +export default function useApp(appSupplier?: AppSupplier): void { let app: Application; beforeAll(async (done) => { @@ -14,7 +14,7 @@ export default function useApp(appSupplier?: (addr: string, port: number) => Pro await MysqlConnectionManager.endPool(); await setupMailServer(); - app = appSupplier ? await appSupplier('127.0.0.1', 8966) : new TestApp('127.0.0.1', 8966); + app = appSupplier ? await appSupplier('127.0.0.1', 8966) : new TestApp('127.0.0.1', 8966, true); await app.start(); done(); @@ -39,3 +39,5 @@ export default function useApp(appSupplier?: (addr: string, port: number) => Pro done(); }); } + +export type AppSupplier = (addr: string, port: number) => Promise;