TestApp: don't ignore commands by default

This commit is contained in:
Alice Gaudon 2021-03-26 10:38:58 +01:00
parent 714e747d6e
commit 9ff832fb6f
5 changed files with 9 additions and 7 deletions

View File

@ -48,8 +48,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;
}

View File

@ -34,7 +34,7 @@ useApp(async (addr, port) => {
await super.init();
}
}(addr, port);
}(addr, port, true);
});
let agent: supertest.SuperTest<supertest.Test>;

View File

@ -37,7 +37,7 @@ useApp(async (addr, port) => {
protected getMigrations(): MigrationType<Migration>[] {
return super.getMigrations().filter(m => m !== AddNameToUsersMigration);
}
}(addr, port);
}(addr, port, true);
});
let agent: supertest.SuperTest<supertest.Test>;

View File

@ -24,7 +24,7 @@ useApp(async (addr, port) => {
await super.init();
}
}(addr, port);
}(addr, port, true);
});
describe('Test CSRF protection', () => {

View File

@ -5,7 +5,7 @@ import MysqlConnectionManager from "../src/db/MysqlConnectionManager";
import config from "config";
export default function useApp(appSupplier?: (addr: string, port: number) => Promise<TestApp>): 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<TestApp>;