test(ai-review): 補日誌 input/output/result helper 與誤報裁決、usage 解析、parseBot 健壯性測試
This commit is contained in:
+20
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, it, afterEach, mock } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { section, step, line, ok, warn, error } from './log.js';
|
||||
import { section, step, line, input, output, result, ok, warn, error } from './log.js';
|
||||
|
||||
afterEach(() => mock.restoreAll());
|
||||
|
||||
@@ -35,6 +35,25 @@ describe('log helpers', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('formats input/output and pass/fail result messages', () => {
|
||||
const calls = [];
|
||||
mock.method(console, 'log', (...args) => {
|
||||
calls.push(args.join(' '));
|
||||
});
|
||||
|
||||
input('5 筆');
|
||||
output('3 筆');
|
||||
result(true, '通過');
|
||||
result(false, '未通過');
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
' ← 輸入:5 筆',
|
||||
' → 輸出:3 筆',
|
||||
' ✅ 成功:通過',
|
||||
' ❌ 失敗:未通過',
|
||||
]);
|
||||
});
|
||||
|
||||
it('formats warn messages with console.warn', () => {
|
||||
const calls = [];
|
||||
mock.method(console, 'warn', (...args) => {
|
||||
|
||||
Reference in New Issue
Block a user