test(ai-review): 更新統計四欄、OpenRouter 精確比對與 codeWindow 邊界測試

This commit is contained in:
Jeffery
2026-06-23 13:15:58 +08:00
parent e73e18f2c3
commit 55bd14e480
3 changed files with 18 additions and 11 deletions
+7
View File
@@ -86,6 +86,13 @@ describe('codeWindow', () => {
it('returns empty string for empty content', () => {
assert.equal(codeWindow('', 10), '');
});
it('handles out-of-range line numbers without throwing', () => {
const content = Array.from({ length: 10 }, (_, i) => `line${i + 1}`).join('\n');
assert.doesNotThrow(() => codeWindow(content, -5, 2));
assert.equal(codeWindow(content, 0, 1), '1: line1\n2: line2'); // 非正數行號 → 從開頭取窗
assert.equal(codeWindow(content, 9999, 2), ''); // 超過檔尾 → 空字串,不丟錯
});
});
describe('judgeConversationsResolved', () => {