fix adapters

This commit is contained in:
2025-12-23 20:43:57 +01:00
parent b5431355ca
commit 16cd572c63
28 changed files with 1357 additions and 15 deletions

View File

@@ -23,37 +23,47 @@ describe('ConsoleLogger', () => {
consoleErrorSpy.mockRestore();
});
it('should call console.debug with the correct arguments when debug is called', () => {
it('should call console.debug with a formatted message when debug is called', () => {
const message = 'Debug message';
const context = { key: 'value' };
logger.debug(message, context);
expect(consoleDebugSpy).toHaveBeenCalledTimes(1);
expect(consoleDebugSpy).toHaveBeenCalledWith(message, context);
expect(consoleDebugSpy).toHaveBeenCalledWith(
expect.stringContaining('DEBUG: Debug message | {"key":"value"}'),
);
});
it('should call console.info with the correct arguments when info is called', () => {
it('should call console.info with a formatted message when info is called', () => {
const message = 'Info message';
const context = { key: 'value' };
logger.info(message, context);
expect(consoleInfoSpy).toHaveBeenCalledTimes(1);
expect(consoleInfoSpy).toHaveBeenCalledWith(message, context);
expect(consoleInfoSpy).toHaveBeenCalledWith(
expect.stringContaining('INFO: Info message | {"key":"value"}'),
);
});
it('should call console.warn with the correct arguments when warn is called', () => {
it('should call console.warn with a formatted message when warn is called', () => {
const message = 'Warn message';
const context = { key: 'value' };
logger.warn(message, context);
expect(consoleWarnSpy).toHaveBeenCalledTimes(1);
expect(consoleWarnSpy).toHaveBeenCalledWith(message, context);
expect(consoleWarnSpy).toHaveBeenCalledWith(
expect.stringContaining('WARN: Warn message | {"key":"value"}'),
);
});
it('should call console.error with the correct arguments when error is called', () => {
it('should call console.error with a formatted message when error is called', () => {
const message = 'Error message';
const error = new Error('Something went wrong');
const context = { key: 'value' };
logger.error(message, error, context);
expect(consoleErrorSpy).toHaveBeenCalledTimes(1);
expect(consoleErrorSpy).toHaveBeenCalledWith(message, error, context);
expect(consoleErrorSpy).toHaveBeenCalledWith(
expect.stringContaining(
'ERROR: Error message | {"key":"value"} | Error: Something went wrong',
),
);
});
});