Skip to content

Commit dc8d1e1

Browse files
authored
Merge pull request #9 from Maddimax/releases/v2.6
Releases/v2.6
2 parents 4e626d5 + d075344 commit dc8d1e1

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

__tests__/main.test.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,43 @@ describe('action', () => {
149149
}
150150
})
151151

152-
fetchMock.mockResponseOnce('Something went wrong', {
153-
status: 400,
154-
statusText: 'Bad Request'
152+
fetchMock.mockResponseOnce(
153+
JSON.stringify({ message: 'Something went wrong' }),
154+
{
155+
status: 400,
156+
statusText: 'Bad Request'
157+
}
158+
)
159+
await main.run()
160+
expect(setFailedMock).toHaveBeenCalledWith(
161+
'HTTP Error: 400, Bad Request, {"message":"Something went wrong"}'
162+
)
163+
})
164+
it('should handle a 500 error', async () => {
165+
getInputMock.mockImplementation(name => {
166+
switch (name) {
167+
case 'test':
168+
return 'false'
169+
case 'spec':
170+
return path.join(__dirname, 'data', 'testspec.lua')
171+
case 'download-url':
172+
return 'https://example.com/test.zip'
173+
case 'api':
174+
return 'https://example.com/'
175+
case 'token':
176+
return 'token'
177+
default:
178+
return ''
179+
}
180+
})
181+
182+
fetchMock.mockResponseOnce('', {
183+
status: 500,
184+
statusText: 'Internal Server Error'
155185
})
156186
await main.run()
157187
expect(setFailedMock).toHaveBeenCalledWith(
158-
'HTTP Error: Something went wrong'
188+
'HTTP Error: 500, Internal Server Error'
159189
)
160190
})
161191
it('Should create a new plugin if not found', async () => {

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/extensionstore.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function createPluginSets(
100100
},
101101
{
102102
name: 'Linux',
103-
version: '20.04.0'
103+
version: '20.4.0'
104104
},
105105
{
106106
name: 'macOS',
@@ -173,8 +173,9 @@ async function request(
173173
body: data ? data : undefined
174174
})
175175
if (!response.ok) {
176+
const errorText = await response.text()
176177
throw new Error(
177-
`HTTP Error: ${(response.status, response.statusText, await response.text())}`
178+
`HTTP Error: ${[response.status, response.statusText, errorText].filter(s => s).join(', ')}`
178179
)
179180
}
180181
return await response.json()

0 commit comments

Comments
 (0)