1
0
mirror of https://github.com/badges/shields.git synced 2025-04-18 19:44:04 +03:00
shields/services/build-status.spec.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

91 lines
2.6 KiB
JavaScript

import { expect } from 'chai'
import { test, given, forCases } from 'sazerac'
import { renderBuildStatusBadge } from './build-status.js'
test(renderBuildStatusBadge, () => {
given({ label: 'build', status: 'passed' }).expect({
label: 'build',
message: 'passing',
color: 'brightgreen',
})
given({ label: 'build', status: 'success' }).expect({
label: 'build',
message: 'passing',
color: 'brightgreen',
})
given({ label: 'build', status: 'partially succeeded' }).expect({
label: 'build',
message: 'passing',
color: 'orange',
})
given({ label: 'build', status: 'failed' }).expect({
label: 'build',
message: 'failing',
color: 'red',
})
given({ label: 'build', status: 'error' }).expect({
label: 'build',
message: 'error',
color: 'red',
})
})
test(renderBuildStatusBadge, () => {
forCases([
given({ status: 'fixed' }),
given({ status: 'passed' }),
given({ status: 'passing' }),
given({ status: 'succeeded' }),
given({ status: 'success' }),
given({ status: 'successful' }),
]).assert('should be brightgreen', b =>
expect(b).to.include({ color: 'brightgreen' }),
)
})
test(renderBuildStatusBadge, () => {
forCases([
given({ status: 'partially succeeded' }),
given({ status: 'timeout' }),
given({ status: 'unstable' }),
]).assert('should be orange', b => expect(b).to.include({ color: 'orange' }))
})
test(renderBuildStatusBadge, () => {
forCases([
given({ status: 'broken' }),
given({ status: 'error' }),
given({ status: 'errored' }),
given({ status: 'failed' }),
given({ status: 'failing' }),
given({ status: 'failure' }),
given({ status: 'infrastructure_failure' }),
]).assert('should be red', b => expect(b).to.include({ color: 'red' }))
})
test(renderBuildStatusBadge, () => {
forCases([
given({ status: 'building' }),
given({ status: 'canceled' }),
given({ status: 'cancelled' }),
given({ status: 'expired' }),
given({ status: 'initiated' }),
given({ status: 'no builds' }),
given({ status: 'no tests' }),
given({ status: 'not built' }),
given({ status: 'not run' }),
given({ status: 'pending' }),
given({ status: 'processing' }),
given({ status: 'queued' }),
given({ status: 'running' }),
given({ status: 'scheduled' }),
given({ status: 'skipped' }),
given({ status: 'starting' }),
given({ status: 'stopped' }),
given({ status: 'testing' }),
given({ status: 'waiting' }),
]).assert('should have undefined color', b =>
expect(b).to.include({ color: undefined }),
)
})