refactor: calculate-version 由 bash 改寫為 Node.js #6
@@ -65,6 +65,18 @@ test('fetchReleases 對非 2xx 回應拋錯', async () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('fetchReleases 對無法解析的 JSON 回應拋錯', async () => {
|
||||||
|
await withFetch(
|
||||||
|
async () => jsonResponse('{ this is not valid json', true),
|
||||||
|
async () => {
|
||||||
|
await assert.rejects(
|
||||||
|
() => fetchReleases('https://gitea.example.com/api'),
|
||||||
|
/回傳資料無法解析/,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('fetchReleases 對非陣列回應拋錯', async () => {
|
test('fetchReleases 對非陣列回應拋錯', async () => {
|
||||||
await withFetch(
|
await withFetch(
|
||||||
async () => jsonResponse({ message: 'oops' }),
|
async () => jsonResponse({ message: 'oops' }),
|
||||||
|
|||||||
Reference in New Issue
Block a user