Skip to content

Commit

Permalink
Fix async mocha tests
Browse files Browse the repository at this point in the history
Missing return for async mocha tests caused the tests to run async and throw errors of one test in another.
This commit makes sure all testAuth tests return a promise to mocha for it to await.
  • Loading branch information
jNullj committed Apr 6, 2024
1 parent 5dc774a commit 1b425aa
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion services/azure-devops/azure-devops-coverage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AzureDevOpsCoverage from './azure-devops-coverage.service.js'
describe('AzureDevOpsCoverage', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
AzureDevOpsCoverage,
'BasicAuth',
{
Expand Down
2 changes: 1 addition & 1 deletion services/azure-devops/azure-devops-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AzureDevOpsTests from './azure-devops-tests.service.js'
describe('AzureDevOpsTests', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
AzureDevOpsTests,
'BasicAuth',
{
Expand Down
2 changes: 1 addition & 1 deletion services/jira/jira-issue.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { config } from './jira-test-helpers.js'
describe('JiraIssue', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
JiraIssue,
'BasicAuth',
{
Expand Down
2 changes: 1 addition & 1 deletion services/jira/jira-sprint.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { config } from './jira-test-helpers.js'
describe('JiraSprint', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
JiraSprint,
'BasicAuth',
{
Expand Down
2 changes: 1 addition & 1 deletion services/nexus/nexus.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('Nexus', function () {
},
}
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
Nexus,
'BasicAuth',
{
Expand Down
2 changes: 1 addition & 1 deletion services/sonar/sonar-fortify-rating.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
describe('SonarFortifyRating', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
SonarFortifyRating,
'BasicAuth',
legacySonarResponse('fortify-security-rating', 4),
Expand Down
27 changes: 16 additions & 11 deletions services/sonar/sonar-generic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ import {
describe('SonarGeneric', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(SonarGeneric, 'BasicAuth', legacySonarResponse('test', 903), {
configOverride: testAuthConfigOverride,
exampleOverride: {
component: 'test',
metricName: 'test',
branch: 'home',
server:
testAuthConfigOverride.public.services.sonar.authorizedOrigins[0],
sonarVersion: '4.2',
return testAuth(
SonarGeneric,
'BasicAuth',
legacySonarResponse('test', 903),
{
configOverride: testAuthConfigOverride,
exampleOverride: {
component: 'test',
metricName: 'test',
branch: 'home',
server:
testAuthConfigOverride.public.services.sonar.authorizedOrigins[0],
sonarVersion: '4.2',
},
ignoreOpenApiExample: true,
},
ignoreOpenApiExample: true,
})
)
})
})
})
2 changes: 1 addition & 1 deletion services/symfony/symfony-insight-grade.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SymfonyInsightGrade from './symfony-insight-grade.service.js'
describe('SymfonyInsightGrade', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
SymfonyInsightGrade,
'BasicAuth',
`<project><last-analysis>
Expand Down
2 changes: 1 addition & 1 deletion services/symfony/symfony-insight-stars.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SymfonyInsightStars from './symfony-insight-stars.service.js'
describe('SymfonyInsightStars', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
SymfonyInsightStars,
'BasicAuth',
`<project><last-analysis>
Expand Down
2 changes: 1 addition & 1 deletion services/symfony/symfony-insight-violations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SymfonyInsightViolations from './symfony-insight-violations.service.js'
describe('SymfonyInsightViolations', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
SymfonyInsightViolations,
'BasicAuth',
`<project><last-analysis>
Expand Down
2 changes: 1 addition & 1 deletion services/teamcity/teamcity-build.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { config } from './teamcity-test-helpers.js'
describe('TeamCityBuild', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
TeamCityBuild,
'BasicAuth',
{ status: 'SUCCESS', statusText: 'Success' },
Expand Down
2 changes: 1 addition & 1 deletion services/teamcity/teamcity-coverage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { config } from './teamcity-test-helpers.js'
describe('TeamCityCoverage', function () {
describe('auth', function () {
it('sends the auth information as configured', async function () {
testAuth(
return testAuth(
TeamCityCoverage,
'BasicAuth',
{
Expand Down

0 comments on commit 1b425aa

Please sign in to comment.