fix(DestinationLocal): Fix debug log rendering, add fallback for unknown log levels, and correct error prefix typo in local destination
This commit is contained in:
@ -92,5 +92,23 @@ tap.test('should create new line(s)', async () => {
|
||||
// Multiple lines
|
||||
testDestination.newLine(3);
|
||||
});
|
||||
// Test debug level rendering and fallback for unknown levels
|
||||
tap.test('should handle debug and unknown log levels', async () => {
|
||||
testDestination = new DestinationLocal();
|
||||
let out = '';
|
||||
const originalLog = console.log;
|
||||
console.log = (msg: string) => { out += msg; };
|
||||
|
||||
// debug level should render message correctly
|
||||
await testDestination.handleLog(createMockLogPackage('debug', 'debug 🎉'));
|
||||
expect(out).toContain('debug 🎉');
|
||||
|
||||
// fallback for unknown level should still render message
|
||||
out = '';
|
||||
await testDestination.handleLog(createMockLogPackage('verbose' as any, 'verbose ⚠️'));
|
||||
expect(out).toContain('verbose ⚠️');
|
||||
|
||||
console.log = originalLog;
|
||||
});
|
||||
|
||||
export default tap.start();
|
Reference in New Issue
Block a user