mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
import { JwtAuthGuard } from '../../../../src/nest/auth-core/jwt-auth.guard';
|
|
import { LlmCapabilitiesController } from '../../../../src/nest/llm-parse/llm-capabilities.controller';
|
|
import type { LlmParseService } from '../../../../src/nest/llm-parse/llm-parse.service';
|
|
import type { User } from '../../../../src/types';
|
|
import { GUARDS_METADATA } from '@nestjs/common/constants';
|
|
|
|
import { describe, it, expect, vi } from 'vitest';
|
|
|
|
describe('LlmCapabilitiesController', () => {
|
|
it("answers whether the caller's model reads images", async () => {
|
|
const readsImages = vi.fn(async (id: number) => id === 1);
|
|
const c = new LlmCapabilitiesController({ readsImages } as unknown as LlmParseService);
|
|
await expect(c.capabilities({ id: 1 } as User)).resolves.toEqual({ images: true });
|
|
await expect(c.capabilities({ id: 2 } as User)).resolves.toEqual({ images: false });
|
|
expect(readsImages).toHaveBeenCalledWith(2);
|
|
});
|
|
|
|
it('needs a session', () => {
|
|
expect(Reflect.getMetadata(GUARDS_METADATA, LlmCapabilitiesController)).toContain(JwtAuthGuard);
|
|
});
|
|
});
|