Fixes #2848 Appveyor briefly has a status of `starting` before the job begins, so adding `starting` to the list of `otherStatuses` to prevent the Appveyor badges from showing `invalid response data` during that window
86 lines
2.3 KiB
JavaScript
86 lines
2.3 KiB
JavaScript
'use strict'
|
|
|
|
const { expect } = require('chai')
|
|
const { test, given, forCases } = require('sazerac')
|
|
const { renderBuildStatusBadge } = require('./build-status')
|
|
|
|
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: 'error' }),
|
|
given({ status: 'failed' }),
|
|
given({ status: 'failing' }),
|
|
]).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: '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: 'waiting' }),
|
|
]).assert('should have undefined color', b =>
|
|
expect(b).to.include({ color: undefined })
|
|
)
|
|
})
|