mirror of
https://github.com/actions/deploy-pages.git
synced 2025-12-09 00:26:14 +00:00
exits early when deployment is not in progress - test
This commit is contained in:
@@ -307,6 +307,49 @@ describe('Deployment', () => {
|
||||
await deployment.check()
|
||||
expect(core.setFailed).toBeCalledWith('Deployment not found.')
|
||||
})
|
||||
|
||||
it('exits early when deployment is not in progress', async () => {
|
||||
process.env.GITHUB_SHA = 'valid-build-version'
|
||||
|
||||
const artifactExchangeScope = nock(`http://my-url`)
|
||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
||||
.reply(200, {
|
||||
value: [
|
||||
{ url: 'https://another-artifact.com', name: 'another-artifact' },
|
||||
{ url: 'https://fake-artifact.com', name: 'github-pages' }
|
||||
]
|
||||
})
|
||||
|
||||
const createDeploymentScope = nock('https://api.github.com')
|
||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
||||
pages_build_version: process.env.GITHUB_SHA,
|
||||
oidc_token: fakeJwt
|
||||
})
|
||||
.reply(200, {
|
||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
||||
page_url: 'https://actions.github.io/is-awesome'
|
||||
})
|
||||
|
||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||
core.GetInput = jest.fn(input => {
|
||||
switch (input) {
|
||||
case 'timeout':
|
||||
return 10 * 1000
|
||||
case 'reporting_interval':
|
||||
return 0
|
||||
}
|
||||
})
|
||||
|
||||
const deployment = new Deployment()
|
||||
await deployment.create(fakeJwt)
|
||||
deployment.deploymentInfo.pending = false
|
||||
await deployment.check()
|
||||
expect(core.setFailed).toBeCalledWith('Unable to get deployment status.')
|
||||
|
||||
artifactExchangeScope.done()
|
||||
createDeploymentScope.done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('#cancel', () => {
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 68.31%"><title>Coverage: 68.31%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">68.31%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">68.31%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="20" role="img" aria-label="Coverage: 69.3%"><title>Coverage: 69.3%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="110" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="47" height="20" fill="#e05d44"/><rect width="110" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="855" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">69.3%</text><text x="855" y="140" transform="scale(.1)" fill="#fff" textLength="370">69.3%</text></g></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user