test(ai-review): 補非整數 idx、空 apiKeys 與 limit 為 0 的邊界測試
This commit is contained in:
@@ -122,6 +122,17 @@ describe('judgeConversationsResolved', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('ignores entries whose idx is not an integer (e.g. a string)', async () => {
|
||||
const items = [{ idx: 0 }, { idx: 1 }];
|
||||
// 字串 idx '0' 不可冒充整數 idx 0 把它改成 resolved
|
||||
const chatFn = async () => [{ idx: '0', resolved: true }, { idx: 1.5, resolved: true }, { idx: 1, resolved: true }];
|
||||
const verdicts = await judgeConversationsResolved(items, chatFn);
|
||||
assert.deepEqual(verdicts, [
|
||||
{ idx: 0, resolved: false },
|
||||
{ idx: 1, resolved: true },
|
||||
]);
|
||||
});
|
||||
|
||||
it('propagates errors thrown by chatFn to the caller', async () => {
|
||||
await assert.rejects(
|
||||
() => judgeConversationsResolved([{ idx: 0 }], async () => { throw new Error('LLM down'); }),
|
||||
|
||||
Reference in New Issue
Block a user