test(release-cleanup): 補上整合測試、server URL 正規化與 id 驗證測試

新增端對端整合測試(列出→刪除舊 release→重列→列 tag→刪孤立 tag 的呼叫順序)、
loadConfig 去尾斜線測試,並將 id 編碼測試改為驗證非整數 id 被略過。測試共 62 項全數通過。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 13:55:48 +08:00
co-authored by Claude Opus 4.8
parent 353a6af7c3
commit edc933be73
3 changed files with 82 additions and 3 deletions
+9
View File
@@ -52,6 +52,15 @@ test('loadConfig 在有效輸入時回傳完整設定物件', () => {
)
})
test('loadConfig 去除 GITEA_SERVER_URL 結尾斜線,避免 API 路徑出現雙斜線', () => {
const cfg = loadConfig({ ...base, GITEA_SERVER_URL: 'https://gitea.example.com/' })
assert.equal(cfg.serverUrl, 'https://gitea.example.com')
assert.equal(
cfg.releaseApiUrl,
'https://gitea.example.com/api/v1/repos/owner/repo/releases',
)
})
test('loadConfig 在提供 token 時保留 token 值', () => {
const cfg = loadConfig({ ...base, GITEA_TOKEN: 'secret' })
assert.equal(cfg.token, 'secret')