mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Remove description of suites and use suite name instead.
This commit is contained in:
parent
2e3e1a7c8b
commit
6ce0ae5d90
|
@ -2,14 +2,15 @@ import WithEnvironment from "./WithEnvironment";
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
interface AutheliaSuiteType {
|
interface AutheliaSuiteType {
|
||||||
(description: string, configPath: string, cb: (this: Mocha.ISuiteCallbackContext) => void): Mocha.ISuite;
|
(suitePath: string, cb: (this: Mocha.ISuiteCallbackContext) => void): Mocha.ISuite;
|
||||||
only: (description: string, configPath: 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,
|
cb: (this: Mocha.ISuiteCallbackContext) => void,
|
||||||
context: (description: string, ctx: (this: Mocha.ISuiteCallbackContext) => void) => Mocha.ISuite) {
|
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')) {
|
if (!fs.existsSync('.suite')) {
|
||||||
WithEnvironment(suite);
|
WithEnvironment(suite);
|
||||||
}
|
}
|
||||||
|
@ -18,16 +19,15 @@ function AutheliaSuiteBase(description: string, suite: string,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const AutheliaSuite = <AutheliaSuiteType>function(
|
const AutheliaSuite = <AutheliaSuiteType>function(suitePath: string,
|
||||||
description: string, configPath: string,
|
|
||||||
cb: (this: Mocha.ISuiteCallbackContext) => void) {
|
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) {
|
cb: (this: Mocha.ISuiteCallbackContext) => void) {
|
||||||
return AutheliaSuiteBase(description, configPath, cb, describe.only);
|
return AutheliaSuiteBase(suitePath, cb, describe.only);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AutheliaSuite as AutheliaSuiteType;
|
export default AutheliaSuite as AutheliaSuiteType;
|
|
@ -1,7 +1,6 @@
|
||||||
import sleep from '../utils/sleep';
|
import sleep from '../utils/sleep';
|
||||||
|
|
||||||
export default function WithAutheliaRunning(suitePath: string, waitTimeout: number = 5000) {
|
export default function WithEnvironment(suite: string, waitTimeout: number = 5000) {
|
||||||
const suite = suitePath.split('/').slice(-1)[0];
|
|
||||||
var { setup, teardown } = require(`../../suites/${suite}/environment`);
|
var { setup, teardown } = require(`../../suites/${suite}/environment`);
|
||||||
|
|
||||||
before(async function() {
|
before(async function() {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import LogoutRedirectToAlreadyLoggedIn from './scenarii/LogoutRedirectToAlreadyL
|
||||||
import SimpleAuthentication from './scenarii/SimpleAuthentication';
|
import SimpleAuthentication from './scenarii/SimpleAuthentication';
|
||||||
import { exec } from '../../helpers/utils/exec';
|
import { exec } from '../../helpers/utils/exec';
|
||||||
|
|
||||||
AutheliaSuite('Simple configuration', __dirname, function() {
|
AutheliaSuite(__dirname, function() {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
|
|
||||||
beforeEach(async function() {
|
beforeEach(async function() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { composeFiles } from './environment';
|
||||||
import Assert from 'assert';
|
import Assert from 'assert';
|
||||||
import SimpleAuthentication from './scenarii/SimpleAuthentication';
|
import SimpleAuthentication from './scenarii/SimpleAuthentication';
|
||||||
|
|
||||||
AutheliaSuite('Dockerhub', __dirname, function() {
|
AutheliaSuite(__dirname, function() {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
const dockerCompose = new DockerCompose(composeFiles);
|
const dockerCompose = new DockerCompose(composeFiles);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import BasicAuthentication from "./scenarii/BasicAuthentication";
|
||||||
import AutheliaRestart from "./scenarii/AutheliaRestart";
|
import AutheliaRestart from "./scenarii/AutheliaRestart";
|
||||||
import AuthenticationRegulation from "./scenarii/AuthenticationRegulation";
|
import AuthenticationRegulation from "./scenarii/AuthenticationRegulation";
|
||||||
|
|
||||||
AutheliaSuite('Complete configuration', __dirname, function() {
|
AutheliaSuite(__dirname, function() {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
|
|
||||||
describe('Custom headers forwarded to backend', CustomHeadersForwarded);
|
describe('Custom headers forwarded to backend', CustomHeadersForwarded);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import AutheliaSuite from "../../helpers/context/AutheliaSuite";
|
import AutheliaSuite from "../../helpers/context/AutheliaSuite";
|
||||||
import Inactivity from './scenarii/Inactivity';
|
import Inactivity from './scenarii/Inactivity';
|
||||||
|
|
||||||
AutheliaSuite('Short timeouts', __dirname, function() {
|
AutheliaSuite(__dirname, function() {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
describe('Inactivity period', Inactivity);
|
describe('Inactivity period', Inactivity);
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user