Update error handling for artifact exchange

This commit is contained in:
James M. Greene
2023-03-08 19:43:11 -06:00
parent 8ca11f25a3
commit 54e5e8c886
3 changed files with 92 additions and 16 deletions
+17
View File
@@ -168,6 +168,23 @@ describe('Deployment', () => {
createDeploymentScope.done()
})
it('reports errors with failed artifact exchange', async () => {
process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`)
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
.reply(400, {})
// Create the deployment
const deployment = new Deployment()
await expect(deployment.create()).rejects.toEqual(
new Error(
`Failed to create deployment (status: 400) with build version ${process.env.GITHUB_SHA}. Responded with: Bad Request`
)
)
artifactExchangeScope.done()
})
it('reports errors with failed deployments', async () => {
process.env.GITHUB_SHA = 'invalid-build-version'
const artifactExchangeScope = nock(`http://my-url`)