[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>
This commit is contained in:
Dominik Grzelak
2020-10-16 01:51:31 +02:00
committed by GitHub
parent cd70bf5246
commit d1ec834cb5
3 changed files with 35 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ const validMessages = [
'in progress',
'queued',
'pending',
'no status yet',
]
const isValidMessages = Joi.equal(...validMessages).required()
@@ -27,3 +28,19 @@ t.create('Deployments (environment not found)')
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',
})