test(release-cleanup): 補強逾時、非陣列、token 邊界與 failError 測試

新增 fetchAllPages 的 AbortError 逾時與非陣列回應測試、loadConfig 的
GITEA_TOKEN 邊界測試,以及 logger.failError 測試。測試共 47 項全數通過。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 11:04:29 +08:00
co-authored by Claude Opus 4.8
parent f6d2ebeab2
commit b9d7c4e970
3 changed files with 71 additions and 0 deletions
+14
View File
@@ -56,3 +56,17 @@ test('loadConfig 在提供 token 時保留 token 值', () => {
const cfg = loadConfig({ ...base, GITEA_TOKEN: 'secret' })
assert.equal(cfg.token, 'secret')
})
test('loadConfig 在 GITEA_TOKEN 為空字串時視為匿名(token 為 null)', () => {
const cfg = loadConfig({ ...base, GITEA_TOKEN: '' })
assert.equal(cfg.token, null)
})
test('loadConfig 接受極短與極長的 GITEA_TOKEN', () => {
const short = loadConfig({ ...base, GITEA_TOKEN: 'x' })
assert.equal(short.token, 'x')
const longToken = 'a'.repeat(1000)
const long = loadConfig({ ...base, GITEA_TOKEN: longToken })
assert.equal(long.token, longToken)
})