test(ai-review): 更新統計四欄、OpenRouter 精確比對與 codeWindow 邊界測試
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user