Files
shields/services/sonar/sonar-quality-gate.tester.js
dependabot[bot] b9d96755ec chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#9357)
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* reformat all the things (prettier 3)

* update tests to await calls to prettier.format()

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2023-07-10 09:27:51 +00:00

70 lines
2.0 KiB
JavaScript

import Joi from 'joi'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
const isQualityGateStatus = Joi.allow('passed', 'failed')
// The service tests targeting the legacy SonarQube API are mocked
// because of the lack of publicly accessible, self-hosted, legacy SonarQube instances
// See https://github.com/badges/shields/issues/4221#issuecomment-546611598 for more details
// This is an uncommon scenario Shields has to support for Sonar, and should not be used as a model
// for other service tests.
t.create('Quality Gate')
.get(
'/quality_gate/swellaby%3Aazdo-shellcheck.json?server=https://sonarcloud.io',
)
.expectBadge({
label: 'quality gate',
message: isQualityGateStatus,
})
t.create('Quality Gate (branch)')
.get(
'/quality_gate/swellaby%3Aazdo-shellcheck/master.json?server=https://sonarcloud.io',
)
.expectBadge({
label: 'quality gate',
message: isQualityGateStatus,
})
t.create('Quality Gate (Alert Status)')
.get(
'/alert_status/org.ow2.petals%3Apetals-se-ase.json?server=http://sonar.petalslink.com&sonarVersion=4.2',
)
.intercept(nock =>
nock('http://sonar.petalslink.com/api')
.get('/resources')
.query({
resource: 'org.ow2.petals:petals-se-ase',
depth: 0,
metrics: 'alert_status',
includeTrends: true,
})
.reply(200, [
{
msr: [
{
key: 'alert_status',
val: 'OK',
},
],
},
]),
)
.expectBadge({
label: 'quality gate',
message: 'passed',
})
// Public instance shared by community member and permission granted for usage in tests
// https://github.com/badges/shields/pull/6636#issuecomment-886172161
t.create('Quality Gate (version >= 6.6)')
.get(
'/quality_gate/de.chkpnt%3Atruststorebuilder-gradle-plugin.json?server=https://sonar.chkpnt.de&sonarVersion=8.9',
)
.expectBadge({
label: 'quality gate',
message: isQualityGateStatus,
})