test(calculate-version): 補 GITEA_REPOSITORY 非法字元與超長段測試
新增含空白/星號/冒號等非法字元,以及單段超過長度上限的拒絕測試。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d8a86e90ea
commit
5e8d58b5f9
@@ -104,6 +104,21 @@ test('loadConfig 於 GITEA_REPOSITORY 邊界格式(空段/缺斜線/多段)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('loadConfig 於 GITEA_REPOSITORY 含非法字元或超長段時拋錯', () => {
|
||||||
|
const bad = [
|
||||||
|
'ow ner/repo',
|
||||||
|
'owner/re*po',
|
||||||
|
'owner/re:po',
|
||||||
|
`${'a'.repeat(101)}/repo`,
|
||||||
|
];
|
||||||
|
for (const repo of bad) {
|
||||||
|
assert.throws(() => loadConfig({
|
||||||
|
GITEA_SERVER_URL: 'https://gitea.example.com',
|
||||||
|
GITEA_REPOSITORY: repo,
|
||||||
|
}), /GITEA_REPOSITORY 格式錯誤/, `應拒絕:${repo}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('loadConfig 接受含點號的合法 owner/repo', () => {
|
test('loadConfig 接受含點號的合法 owner/repo', () => {
|
||||||
const config = loadConfig({
|
const config = loadConfig({
|
||||||
GITEA_SERVER_URL: 'https://gitea.example.com',
|
GITEA_SERVER_URL: 'https://gitea.example.com',
|
||||||
|
|||||||
Reference in New Issue
Block a user