Skip to content

Commit 06c1e05

Browse files
committed
fix(tests): update test output
1 parent f327f74 commit 06c1e05

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

proxy/src/adapters/bedrock.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ describe('BedrockAdapter', () => {
88
beforeEach(() => {
99
// Arrange
1010
adapter = new BedrockAdapter();
11+
jest.spyOn(console, 'warn').mockImplementation();
12+
});
13+
14+
afterEach(() => {
15+
jest.restoreAllMocks();
1116
});
1217

1318
describe('canHandleRequest', () => {
@@ -493,7 +498,6 @@ describe('BedrockAdapter', () => {
493498
describe('handler selection', () => {
494499
it('should log warning when no handler found for model', () => {
495500
// Arrange
496-
const consoleSpy = jest.spyOn(console, 'warn').mockImplementation();
497501
const request: ProviderRequest = {
498502
url: '/model/unknown.model-v1/invoke',
499503
method: 'POST',
@@ -507,11 +511,9 @@ describe('BedrockAdapter', () => {
507511
adapter.transformRequest(request as any);
508512

509513
// Assert
510-
expect(consoleSpy).toHaveBeenCalledWith(
514+
expect(console.warn).toHaveBeenCalledWith(
511515
expect.stringContaining('No handler found for Bedrock model: unknown.model-v1')
512516
);
513-
514-
consoleSpy.mockRestore();
515517
});
516518

517519
it('should fall back to Anthropic handler when no handler matches', () => {

proxy/src/config.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ describe('config', () => {
1111

1212
beforeEach(() => {
1313
jest.clearAllMocks();
14+
jest.spyOn(console, 'log').mockImplementation();
15+
jest.spyOn(console, 'error').mockImplementation();
1416
delete process.env.CONFIG_PATH;
1517
});
1618

19+
afterEach(() => {
20+
jest.restoreAllMocks();
21+
});
22+
1723
describe('loadConfig', () => {
1824
it('should load configuration from default path when CONFIG_PATH is not set', () => {
1925
// Arrange

proxy/src/runners/runner-orchestrator.spec.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe('RunnerOrchestrator', () => {
1111

1212
beforeEach(() => {
1313
jest.clearAllMocks();
14+
jest.spyOn(console, 'log').mockImplementation();
1415

1516
// Arrange - default config
1617
mockConfig = {
@@ -43,37 +44,31 @@ describe('RunnerOrchestrator', () => {
4344
};
4445
});
4546

47+
afterEach(() => {
48+
jest.restoreAllMocks();
49+
});
50+
4651
describe('constructor', () => {
4752
it('should initialize vLLM runner', () => {
48-
// Arrange
49-
const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
50-
51-
// Act
53+
// Arrange & Act
5254
new RunnerOrchestrator(mockConfig);
5355

5456
// Assert
5557
expect(VLLMRunner).toHaveBeenCalledWith('http://localhost:8000');
56-
expect(consoleSpy).toHaveBeenCalledWith(
58+
expect(console.log).toHaveBeenCalledWith(
5759
expect.stringContaining('Registered runner: vllm-runner-1')
5860
);
59-
60-
consoleSpy.mockRestore();
6161
});
6262

6363
it('should initialize Ollama runner', () => {
64-
// Arrange
65-
const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
66-
67-
// Act
64+
// Arrange & Act
6865
new RunnerOrchestrator(mockConfig);
6966

7067
// Assert
7168
expect(OllamaRunner).toHaveBeenCalledWith('http://localhost:11434');
72-
expect(consoleSpy).toHaveBeenCalledWith(
69+
expect(console.log).toHaveBeenCalledWith(
7370
expect.stringContaining('Registered runner: ollama-runner-1')
7471
);
75-
76-
consoleSpy.mockRestore();
7772
});
7873

7974
it('should initialize TGI runner as vLLM runner', () => {

0 commit comments

Comments
 (0)