test(calculate-version): 整併重複測試至 app/test 並新增 logger 測試

This commit is contained in:
Jeffery
2026-06-30 12:42:11 +08:00
parent 7954fda311
commit 04e1ada80a
7 changed files with 104 additions and 270 deletions
+8
View File
@@ -68,3 +68,11 @@ test('fetchReleases 在 null 回應時視為無更多資料', async () => {
const releases = await fetchReleases('https://gitea.example.com/api/v1/repos/o/r/releases');
assert.deepEqual(releases, []);
});
test('fetchReleases 在回傳無法解析的 JSON 時丟出例外', async () => {
globalThis.fetch = async () => ({ ok: true, text: async () => '{ this is not valid json' });
await assert.rejects(
() => fetchReleases('https://gitea.example.com/api/v1/repos/o/r/releases'),
/回傳資料無法解析/,
);
});