Browse Source

TestApp: don't ignore commands by default

develop
Alice Gaudon 3 weeks ago
parent
commit
9ff832fb6f
5 changed files with 9 additions and 7 deletions
  1. +2
    -2
      src/TestApp.ts
  2. +1
    -1
      test/Authentication.test.ts
  3. +1
    -1
      test/AuthenticationNoUsername.test.ts
  4. +1
    -1
      test/CsrfProtectionComponent.test.ts
  5. +4
    -2
      test/_app.ts

+ 2
- 2
src/TestApp.ts 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;
}


+ 1
- 1
test/Authentication.test.ts View File

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


+ 1
- 1
test/AuthenticationNoUsername.test.ts 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>;


+ 1
- 1
test/CsrfProtectionComponent.test.ts View File

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


+ 4
- 2
test/_app.ts 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>;

Loading…
Cancel
Save