Skip to content

Commit ef75307

Browse files
committed
Update vlm.service.spec.ts
1 parent 7497e58 commit ef75307

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/compare/libs/vlm/vlm.service.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22
import { TestStatus } from '@prisma/client';
33
import { PNG } from 'pngjs';
4+
import { z } from 'zod';
45
import { StaticService } from '../../../static/static.service';
56
import { NO_BASELINE_RESULT, EQUAL_RESULT } from '../consts';
67
import { DEFAULT_CONFIG, VlmService } from './vlm.service';
@@ -254,16 +255,22 @@ describe('VlmService', () => {
254255
{ model: 'llava:13b', prompt: 'Custom context', temperature: 0.2 }
255256
);
256257

258+
const VlmComparisonResultSchema = z.object({
259+
identical: z.boolean(),
260+
description: z.string(),
261+
});
262+
const expectedJsonSchema = z.toJSONSchema(VlmComparisonResultSchema);
263+
257264
expect(ollamaGenerateMock).toHaveBeenCalledWith({
258265
model: 'llava:13b',
259266
messages: [
260267
{
261268
role: 'user',
262-
content: expect.stringContaining('Custom context'),
269+
content: 'Custom context',
263270
images: expect.arrayContaining([expect.any(Uint8Array), expect.any(Uint8Array), expect.any(Uint8Array)]),
264271
},
265272
],
266-
format: 'json',
273+
format: expectedJsonSchema,
267274
options: { temperature: 0.2 },
268275
});
269276
});

0 commit comments

Comments
 (0)