Files
shields/services/github/github-deployments.tester.js
Dominik Grzelak d1ec834cb5 [Github] Handle the case when the Github deployment status returns null (#5704)
* Handle the case when the Github deployment status returns null

* Integration test null latestStatus response from Github Deployments

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-10-15 23:51:31 +00:00

47 lines
1022 B
JavaScript

'use strict'
const Joi = require('joi')
const t = (module.exports = require('../tester').createServiceTester())
const validMessages = [
'success',
'error',
'failure',
'inactive',
'in progress',
'queued',
'pending',
'no status yet',
]
const isValidMessages = Joi.equal(...validMessages).required()
t.create('Deployments')
.get('/badges/shields/shields-staging.json')
.expectBadge({
label: 'state',
message: isValidMessages,
})
t.create('Deployments (environment not found)')
.get('/badges/shields/does-not-exist.json')
.expectBadge({
label: 'state',
message: 'environment not found',
})
t.create('Deployments (status not yet available)')
.get('/badges/shields/shields-staging.json')
.intercept(nock =>
nock('https://api.github.com/')
.post('/graphql')
.reply(200, {
data: {
repository: { deployments: { nodes: [{ latestStatus: null }] } },
},
})
)
.expectBadge({
label: 'state',
message: 'no status yet',
})