Remove description of suites and use suite name instead.

This commit is contained in:
Clement Michaud 2019-03-02 23:31:22 +01:00
parent 2e3e1a7c8b
commit 6ce0ae5d90
6 changed files with 14 additions and 15 deletions

View File

@ -2,14 +2,15 @@ import WithEnvironment from "./WithEnvironment";
import fs from 'fs';
interface AutheliaSuiteType {
(description: string, configPath: string, cb: (this: Mocha.ISuiteCallbackContext) => void): Mocha.ISuite;
only: (description: string, configPath: string, cb: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite;
(suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void): Mocha.ISuite;
only: (suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite;
}
function AutheliaSuiteBase(description: string, suite: string,
function AutheliaSuiteBase(suitePath: string,
cb: (this: Mocha.ISuiteCallbackContext) => void,
context: (description: string, ctx: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite) {
return context('Suite: ' + description, function(this: Mocha.ISuiteCallbackContext) {
const suite = suitePath.split('/').slice(-1)[0];
return context('Suite: ' + suite, function(this: Mocha.ISuiteCallbackContext) {
if (!fs.existsSync('.suite')) {
WithEnvironment(suite);
}
@ -18,16 +19,15 @@ function AutheliaSuiteBase(description: string, suite: string,
});
}
const AutheliaSuite = <AutheliaSuiteType>function(
description: string, configPath: string,
const AutheliaSuite = <AutheliaSuiteType>function(suitePath: string,
cb: (this: Mocha.ISuiteCallbackContext) => void) {
return AutheliaSuiteBase(description, configPath, cb, describe);
return AutheliaSuiteBase(suitePath, cb, describe);
}
AutheliaSuite.only = function(description: string, configPath: string,
AutheliaSuite.only = function(suitePath: string,
cb: (this: Mocha.ISuiteCallbackContext) => void) {
return AutheliaSuiteBase(description, configPath, cb, describe.only);
return AutheliaSuiteBase(suitePath, cb, describe.only);
}
export default AutheliaSuite as AutheliaSuiteType;

View File

@ -1,7 +1,6 @@
import sleep from '../utils/sleep';
export default function WithAutheliaRunning(suitePath: string, waitTimeout: number = 5000) {
const suite = suitePath.split('/').slice(-1)[0];
export default function WithEnvironment(suite: string, waitTimeout: number = 5000) {
var { setup, teardown } = require(`../../suites/${suite}/environment`);
before(async function() {

View File

@ -10,7 +10,7 @@ import LogoutRedirectToAlreadyLoggedIn from './scenarii/LogoutRedirectToAlreadyL
import SimpleAuthentication from './scenarii/SimpleAuthentication';
import { exec } from '../../helpers/utils/exec';
AutheliaSuite('Simple configuration', __dirname, function() {
AutheliaSuite(__dirname, function() {
this.timeout(10000);
beforeEach(async function() {

View File

@ -4,7 +4,7 @@ import { composeFiles } from './environment';
import Assert from 'assert';
import SimpleAuthentication from './scenarii/SimpleAuthentication';
AutheliaSuite('Dockerhub', __dirname, function() {
AutheliaSuite(__dirname, function() {
this.timeout(15000);
const dockerCompose = new DockerCompose(composeFiles);

View File

@ -8,7 +8,7 @@ import BasicAuthentication from "./scenarii/BasicAuthentication";
import AutheliaRestart from "./scenarii/AutheliaRestart";
import AuthenticationRegulation from "./scenarii/AuthenticationRegulation";
AutheliaSuite('Complete configuration', __dirname, function() {
AutheliaSuite(__dirname, function() {
this.timeout(10000);
describe('Custom headers forwarded to backend', CustomHeadersForwarded);

View File

@ -1,7 +1,7 @@
import AutheliaSuite from "../../helpers/context/AutheliaSuite";
import Inactivity from './scenarii/Inactivity';
AutheliaSuite('Short timeouts', __dirname, function() {
AutheliaSuite(__dirname, function() {
this.timeout(10000);
describe('Inactivity period', Inactivity);
});