test: 整併測試至 app/test 並解決 AI 審查 findings #8
@@ -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', () => {
|
||||
const config = loadConfig({
|
||||
GITEA_SERVER_URL: 'https://gitea.example.com',
|
||||
|
||||
Reference in New Issue
Block a user