diff --git a/test/releases.test.js b/test/releases.test.js index 560957f..c305bf9 100644 --- a/test/releases.test.js +++ b/test/releases.test.js @@ -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 () => { await withFetch( async () => jsonResponse({ message: 'oops' }),