Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,43 @@ describe('action', () => {
}
})

fetchMock.mockResponseOnce('Something went wrong', {
status: 400,
statusText: 'Bad Request'
fetchMock.mockResponseOnce(
JSON.stringify({ message: 'Something went wrong' }),
{
status: 400,
statusText: 'Bad Request'
}
)
await main.run()
expect(setFailedMock).toHaveBeenCalledWith(
'HTTP Error: 400, Bad Request, {"message":"Something went wrong"}'
)
})
it('should handle a 500 error', async () => {
getInputMock.mockImplementation(name => {
switch (name) {
case 'test':
return 'false'
case 'spec':
return path.join(__dirname, 'data', 'testspec.lua')
case 'download-url':
return 'https://example.com/test.zip'
case 'api':
return 'https://example.com/'
case 'token':
return 'token'
default:
return ''
}
})

fetchMock.mockResponseOnce('', {
status: 500,
statusText: 'Internal Server Error'
})
await main.run()
expect(setFailedMock).toHaveBeenCalledWith(
'HTTP Error: Something went wrong'
'HTTP Error: 500, Internal Server Error'
)
})
it('Should create a new plugin if not found', async () => {
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/extensionstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function createPluginSets(
},
{
name: 'Linux',
version: '20.04.0'
version: '20.4.0'
},
{
name: 'macOS',
Expand Down Expand Up @@ -173,8 +173,9 @@ async function request(
body: data ? data : undefined
})
if (!response.ok) {
const errorText = await response.text()
throw new Error(
`HTTP Error: ${(response.status, response.statusText, await response.text())}`
`HTTP Error: ${[response.status, response.statusText, errorText].filter(s => s).join(', ')}`
)
}
return await response.json()
Expand Down