|
| 1 | +import { test, expect } from 'bun:test'; |
| 2 | +import { logger, createLogger } from '../../../src/utils/logger'; |
| 3 | + |
| 4 | +test("Must create a logger instance", () => { |
| 5 | + expect(logger).toBeDefined(); |
| 6 | +}); |
| 7 | + |
| 8 | +test("Must log info message without throwing", () => { |
| 9 | + expect(() => logger.info("This is an info message")).not.toThrow(); |
| 10 | +}); |
| 11 | + |
| 12 | +test("Must log success message without throwing", () => { |
| 13 | + expect(() => logger.success("This is a success message")).not.toThrow(); |
| 14 | +}); |
| 15 | + |
| 16 | +test("Must log warning message without throwing", () => { |
| 17 | + expect(() => logger.warn("This is a warning message")).not.toThrow(); |
| 18 | +}); |
| 19 | + |
| 20 | +test("Must log error message without throwing", () => { |
| 21 | + expect(() => logger.error("This is an error message")).not.toThrow(); |
| 22 | +}); |
| 23 | + |
| 24 | +test("Must log debug message without throwing", () => { |
| 25 | + expect(() => logger.debug("This is a debug message")).not.toThrow(); |
| 26 | +}); |
| 27 | + |
| 28 | +test("Must pretty print JSON without throwing", () => { |
| 29 | + expect(() => logger.prettyJson("Test Object", { foo: "bar", baz: 42 })).not.toThrow(); |
| 30 | +}); |
| 31 | + |
| 32 | +test("Must create scoped logger instance", () => { |
| 33 | + const scopedLogger = createLogger("TestScope"); |
| 34 | + expect(scopedLogger).toBeDefined(); |
| 35 | +}); |
| 36 | + |
| 37 | +test("Scoped logger must log info without throwing", () => { |
| 38 | + const scopedLogger = createLogger("TestScope"); |
| 39 | + expect(() => scopedLogger.info("Scoped info message")).not.toThrow(); |
| 40 | +}); |
0 commit comments