Files
shields/services/docker/docker-cloud-build.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

76 lines
2.2 KiB
JavaScript

import { isBuildStatus } from '../build-status.js'
import { createServiceTester } from '../tester.js'
import { dockerBlue } from './docker-helpers.js'
export const t = await createServiceTester()
t.create('docker cloud build status (valid user)')
.get('/pavics/magpie.json')
.expectBadge({
label: 'docker build',
message: isBuildStatus,
})
t.create('docker cloud build status (invalid, nonexisting user)')
.get('/pavicsssss/magpie.json')
.expectBadge({
label: 'docker build',
message: 'automated builds not set up',
})
t.create(
"docker cloud build status (valid user, but the 'objects' array from the response is empty)",
)
.get('/pavics/weaver.json')
.expectBadge({
label: 'docker build',
message: 'automated builds not set up',
})
t.create('docker cloud build status (not found)')
.get('/badges/not-a-real-repo.json')
.intercept(nock =>
nock('https://cloud.docker.com/')
.get(
`/api/build/v1/source?image=${encodeURIComponent(
'badges/not-a-real-repo',
)}`,
)
.reply(404, { detail: 'Object not found' }),
)
.expectBadge({ label: 'docker build', message: 'repo not found' })
t.create('docker cloud build status (passing)')
.get('/xenolf/lego.json')
.intercept(nock =>
nock('https://cloud.docker.com/')
.get(`/api/build/v1/source?image=${encodeURIComponent('xenolf/lego')}`)
.reply(200, { objects: [{ state: 'Success' }] }),
)
.expectBadge({
label: 'docker build',
message: 'passing',
color: 'brightgreen',
})
t.create('docker cloud build status (failing)')
.get('/xenolf/lego.json')
.intercept(nock =>
nock('https://cloud.docker.com/')
.get(`/api/build/v1/source?image=${encodeURIComponent('xenolf/lego')}`)
.reply(200, { objects: [{ state: 'Failed' }] }),
)
.expectBadge({ label: 'docker build', message: 'failing', color: 'red' })
t.create('docker cloud build status (building)')
.get('/xenolf/lego.json')
.intercept(nock =>
nock('https://cloud.docker.com/')
.get(`/api/build/v1/source?image=${encodeURIComponent('xenolf/lego')}`)
.reply(200, { objects: [{ state: 'Empty' }] }),
)
.expectBadge({
label: 'docker build',
message: 'building',
color: `#${dockerBlue}`,
})