2024-08-20 07:41:08 +08:00
|
|
|
import { AiAssert } from '@/ai-model';
|
2025-02-10 16:36:12 +08:00
|
|
|
import { getContextFromFixture } from '@/evaluation';
|
2024-08-20 07:41:08 +08:00
|
|
|
/* eslint-disable max-lines-per-function */
|
|
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
|
|
|
|
|
|
vi.setConfig({
|
|
|
|
testTimeout: 180 * 1000,
|
|
|
|
hookTimeout: 30 * 1000,
|
|
|
|
});
|
|
|
|
|
2025-01-03 21:50:25 +08:00
|
|
|
describe('assert', () => {
|
|
|
|
it('todo pass', async () => {
|
2025-02-10 16:36:12 +08:00
|
|
|
const { context } = await getContextFromFixture('todo');
|
2024-08-20 07:41:08 +08:00
|
|
|
|
2025-01-03 21:50:25 +08:00
|
|
|
const {
|
|
|
|
content: { pass },
|
|
|
|
} = await AiAssert({
|
|
|
|
assertion: 'Three tasks have been added',
|
|
|
|
context,
|
2024-08-20 07:41:08 +08:00
|
|
|
});
|
2025-01-03 21:50:25 +08:00
|
|
|
expect(pass).toBe(true);
|
|
|
|
});
|
2024-08-20 07:41:08 +08:00
|
|
|
|
2025-01-03 21:50:25 +08:00
|
|
|
it('todo error', async () => {
|
2025-02-10 16:36:12 +08:00
|
|
|
const { context } = await getContextFromFixture('todo');
|
2024-08-20 07:41:08 +08:00
|
|
|
|
2025-01-03 21:50:25 +08:00
|
|
|
const {
|
|
|
|
content: { pass, thought },
|
|
|
|
} = await AiAssert({
|
|
|
|
assertion: 'There are four tasks in the task list',
|
|
|
|
context,
|
2024-08-20 07:41:08 +08:00
|
|
|
});
|
2025-01-03 21:50:25 +08:00
|
|
|
expect(pass).toBe(false);
|
2024-08-20 07:41:08 +08:00
|
|
|
});
|
|
|
|
});
|