test: make tests readable

This commit is contained in:
Rainer Killinger
2021-09-06 14:36:33 +02:00
parent 8dffe29146
commit cb890556d7

View File

@@ -143,7 +143,7 @@ export class MainSpec {
} }
@test @test
checkIfContainerDoesNotMatchAnyContainer() { 'check if container does not match any container'() {
expect(containerMatchesRegex( expect(containerMatchesRegex(
'anyName', 'anyName',
new RegExp('d+'), new RegExp('d+'),
@@ -152,7 +152,7 @@ export class MainSpec {
} }
@test @test
checkIfContainerDoesNotMatchIfVersionIsIncorrect() { 'check if container does not match if version is incorrect'() {
expect(containerMatchesRegex( expect(containerMatchesRegex(
'backend', 'backend',
new RegExp('1\\.4\\.\\d+'), new RegExp('1\\.4\\.\\d+'),
@@ -161,7 +161,7 @@ export class MainSpec {
} }
@test @test
checkIfContainerMatches() { 'check if container matches'() {
expect(containerMatchesRegex( expect(containerMatchesRegex(
'backend', 'backend',
new RegExp('1\\.0\\.\\d+'), new RegExp('1\\.0\\.\\d+'),
@@ -170,7 +170,7 @@ export class MainSpec {
} }
@test @test
async getGatewayOfAnyContainerWithExposedPorts() { async 'get gateway of any container with exposed ports'() {
expect(await getGatewayOfStAppsBackend(MainSpec.anyContainerWithExposedPorts)).to.be.equal('0.0.0.0:80'); expect(await getGatewayOfStAppsBackend(MainSpec.anyContainerWithExposedPorts)).to.be.equal('0.0.0.0:80');
} }
@@ -195,7 +195,7 @@ export class MainSpec {
} }
@test @test
async upstreamMapCallsLoggerErrorWhenNoMatchingContainerIsFound() { async 'upstream map calls logger error when no matching container is found'() {
const spy = MainSpec.sandbox.on(console, 'error', () => { const spy = MainSpec.sandbox.on(console, 'error', () => {
}); });
@@ -214,7 +214,7 @@ export class MainSpec {
} }
@test @test
async upstreamMapWithOneActiveVersionAndNoOutdatedOnes() { async 'upstream map with one active version and no outdated ones'() {
expect(await generateUpstreamMap( expect(await generateUpstreamMap(
['1\\.0\\.\\d+'], ['1\\.0\\.\\d+'],
['0\\.8\\.\\d+'], ['0\\.8\\.\\d+'],
@@ -231,7 +231,7 @@ upstream 1__0___d_ {
} }
@test @test
async testGetContainers() { async 'get containers'() {
try { try {
await getContainers(); await getContainers();
return false; return false;
@@ -254,7 +254,7 @@ Please check if docker is running and Node.js can access the docker socket (/var
} }
@test @test
async testGetTemplateView() { async 'get template view'() {
try { try {
let containersWithSameVersion = [MainSpec.backendContainerWithExposedPorts, MainSpec.backendContainerWithExposedPorts]; let containersWithSameVersion = [MainSpec.backendContainerWithExposedPorts, MainSpec.backendContainerWithExposedPorts];
@@ -269,7 +269,7 @@ Please check if docker is running and Node.js can access the docker socket (/var
} }
@test @test
createListenerFaultyConfig() { 'create listener faulty config'() {
expect(generateListener({ expect(generateListener({
certificate: 'faultyTest', certificate: 'faultyTest',
@@ -285,7 +285,7 @@ ${protocolHardeningParameters}
} }
@test @test
createListenerCorrectConfig() { 'create listener correct config'() {
const testCertDir = resolve(__dirname, 'certs'); const testCertDir = resolve(__dirname, 'certs');
mkdirSync(testCertDir); mkdirSync(testCertDir);