Skip to content

Commit b64a731

Browse files
add console mocking and afterEach cleanup to llm utils tests
1 parent fc6c3da commit b64a731

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

__tests__/unit/server/llm-utils.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'vitest';
1+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
22
import {
33
extractFileReferences,
44
createReferencedFilesContext,
@@ -12,6 +12,15 @@ import type { FileMap } from '~/lib/.server/llm/constants';
1212
import type { Message } from 'ai';
1313

1414
describe('LLM Utils - File References', () => {
15+
beforeEach(() => {
16+
vi.spyOn(console, 'log').mockImplementation(() => { });
17+
vi.spyOn(console, 'error').mockImplementation(() => { });
18+
});
19+
20+
afterEach(() => {
21+
vi.restoreAllMocks();
22+
});
23+
1524
describe('extractFileReferences', () => {
1625
it('should extract single file reference', () => {
1726
const text = 'Can you check @src/index.ts?';

0 commit comments

Comments
 (0)