Skip to content

Commit 57600ec

Browse files
authored
chore(test): ut for disable thinking in AiJudgeOrderSensitive (#2298)
1 parent cd899a1 commit 57600ec

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { AiJudgeOrderSensitive } from '@/ai-model/inspect';
2+
import type { IModelConfig } from '@midscene/shared/env';
3+
import { describe, expect, it, vi } from 'vitest';
4+
5+
describe('AiJudgeOrderSensitive', () => {
6+
it('forces deepThink to false when judging order sensitivity', async () => {
7+
const callAIFn = vi.fn().mockResolvedValue({
8+
content: { isOrderSensitive: true },
9+
usage: { total_tokens: 12 },
10+
});
11+
12+
const modelConfig: IModelConfig = {
13+
modelName: 'test-model',
14+
modelDescription: 'test model',
15+
intent: 'default',
16+
};
17+
18+
const result = await AiJudgeOrderSensitive(
19+
'the button to the right of login',
20+
callAIFn as any,
21+
modelConfig,
22+
);
23+
24+
expect(callAIFn).toHaveBeenCalledWith(
25+
[
26+
expect.objectContaining({ role: 'system' }),
27+
expect.objectContaining({
28+
role: 'user',
29+
content:
30+
'Analyze this element description: "the button to the right of login"',
31+
}),
32+
],
33+
modelConfig,
34+
{ deepThink: false },
35+
);
36+
37+
expect(result).toEqual({
38+
isOrderSensitive: true,
39+
usage: { total_tokens: 12 },
40+
});
41+
});
42+
});

0 commit comments

Comments
 (0)