added questdb-client integration tests
This commit is contained in:
parent
d0bc9cf32f
commit
674112af05
3 changed files with 379 additions and 38 deletions
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { newDb } from 'pg-mem';
|
||||
import { mock, spyOn, beforeAll, beforeEach } from 'bun:test';
|
||||
|
||||
// Mock PostgreSQL database for unit tests
|
||||
let pgMem: any;
|
||||
|
|
@ -43,10 +44,73 @@ beforeAll(() => {
|
|||
throw new Error(`Unsupported date unit: ${unit}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}); // Mock QuestDB HTTP client
|
||||
(global as any).fetch = () => {}; // Using Bun's built-in spyOn utilities
|
||||
global.spyOn(global, 'fetch');
|
||||
} }); // Mock QuestDB HTTP client
|
||||
// Mock fetch using Bun's built-in mock
|
||||
(global as any).fetch = mock(() => {});
|
||||
|
||||
// Mock the logger module to avoid Pino configuration conflicts
|
||||
mock.module('@stock-bot/logger', () => ({
|
||||
Logger: mock(() => ({
|
||||
info: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
debug: mock(() => {}),
|
||||
fatal: mock(() => {}),
|
||||
trace: mock(() => {}),
|
||||
child: mock(() => ({
|
||||
info: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
debug: mock(() => {}),
|
||||
fatal: mock(() => {}),
|
||||
trace: mock(() => {}),
|
||||
}))
|
||||
})),
|
||||
getLogger: mock(() => ({
|
||||
info: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
debug: mock(() => {}),
|
||||
fatal: mock(() => {}),
|
||||
trace: mock(() => {}),
|
||||
child: mock(() => ({
|
||||
info: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
debug: mock(() => {}),
|
||||
fatal: mock(() => {}),
|
||||
trace: mock(() => {}),
|
||||
}))
|
||||
}))
|
||||
}));
|
||||
|
||||
// Mock Pino and its transports to avoid configuration conflicts
|
||||
mock.module('pino', () => ({
|
||||
default: mock(() => ({
|
||||
info: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
debug: mock(() => {}),
|
||||
fatal: mock(() => {}),
|
||||
trace: mock(() => {}),
|
||||
child: mock(() => ({
|
||||
info: mock(() => {}),
|
||||
warn: mock(() => {}),
|
||||
error: mock(() => {}),
|
||||
debug: mock(() => {}),
|
||||
fatal: mock(() => {}),
|
||||
trace: mock(() => {}),
|
||||
}))
|
||||
}))
|
||||
}));
|
||||
|
||||
mock.module('pino-pretty', () => ({
|
||||
default: mock(() => ({}))
|
||||
}));
|
||||
|
||||
mock.module('pino-loki', () => ({
|
||||
default: mock(() => ({}))
|
||||
}));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue