Add prettier configuration
This commit is contained in:
@@ -18,29 +18,36 @@ describe('enablePages', () => {
|
||||
})
|
||||
|
||||
it('makes a request to create a page', async () => {
|
||||
jest
|
||||
.spyOn(axios, 'post')
|
||||
.mockImplementationOnce(() => Promise.resolve({ }))
|
||||
jest.spyOn(axios, 'post').mockImplementationOnce(() => Promise.resolve({}))
|
||||
|
||||
await enablePages({ repositoryNwo: GITHUB_REPOSITORY, githubToken: GITHUB_TOKEN })
|
||||
await enablePages({
|
||||
repositoryNwo: GITHUB_REPOSITORY,
|
||||
githubToken: GITHUB_TOKEN
|
||||
})
|
||||
})
|
||||
|
||||
it('handles a 409 response when the page already exists', async () => {
|
||||
jest
|
||||
.spyOn(axios, 'post')
|
||||
.mockImplementationOnce(() => Promise.reject({ response: { status: 409 } }))
|
||||
.mockImplementationOnce(() => Promise.reject({response: {status: 409}}))
|
||||
|
||||
// Simply assert that no error is raised
|
||||
await enablePages({ repositoryNwo: GITHUB_REPOSITORY, githubToken: GITHUB_TOKEN })
|
||||
await enablePages({
|
||||
repositoryNwo: GITHUB_REPOSITORY,
|
||||
githubToken: GITHUB_TOKEN
|
||||
})
|
||||
})
|
||||
|
||||
it('re-raises errors on failure status codes', async () => {
|
||||
jest
|
||||
.spyOn(axios, 'post')
|
||||
.mockImplementationOnce(() => Promise.reject({ response: { status: 404 } }))
|
||||
.mockImplementationOnce(() => Promise.reject({response: {status: 404}}))
|
||||
|
||||
try {
|
||||
await enablePages({ repositoryNwo: GITHUB_REPOSITORY, githubToken: GITHUB_TOKEN })
|
||||
await enablePages({
|
||||
repositoryNwo: GITHUB_REPOSITORY,
|
||||
githubToken: GITHUB_TOKEN
|
||||
})
|
||||
} catch (error) {
|
||||
expect(error.response.status).toEqual(404)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user