|
1 | 1 | import { Test, TestingModule } from '@nestjs/testing'; |
2 | 2 | import { TestStatus } from '@prisma/client'; |
3 | 3 | import { PNG } from 'pngjs'; |
| 4 | +import { z } from 'zod'; |
4 | 5 | import { StaticService } from '../../../static/static.service'; |
5 | 6 | import { NO_BASELINE_RESULT, EQUAL_RESULT } from '../consts'; |
6 | 7 | import { DEFAULT_CONFIG, VlmService } from './vlm.service'; |
@@ -254,16 +255,22 @@ describe('VlmService', () => { |
254 | 255 | { model: 'llava:13b', prompt: 'Custom context', temperature: 0.2 } |
255 | 256 | ); |
256 | 257 |
|
| 258 | + const VlmComparisonResultSchema = z.object({ |
| 259 | + identical: z.boolean(), |
| 260 | + description: z.string(), |
| 261 | + }); |
| 262 | + const expectedJsonSchema = z.toJSONSchema(VlmComparisonResultSchema); |
| 263 | + |
257 | 264 | expect(ollamaGenerateMock).toHaveBeenCalledWith({ |
258 | 265 | model: 'llava:13b', |
259 | 266 | messages: [ |
260 | 267 | { |
261 | 268 | role: 'user', |
262 | | - content: expect.stringContaining('Custom context'), |
| 269 | + content: 'Custom context', |
263 | 270 | images: expect.arrayContaining([expect.any(Uint8Array), expect.any(Uint8Array), expect.any(Uint8Array)]), |
264 | 271 | }, |
265 | 272 | ], |
266 | | - format: 'json', |
| 273 | + format: expectedJsonSchema, |
267 | 274 | options: { temperature: 0.2 }, |
268 | 275 | }); |
269 | 276 | }); |
|
0 commit comments