import { describe, test, expect } from "bun:test";
import { createLogger } from "@/utils/logger.js";

describe("createLogger", () => {
  test("returns a pino logger instance when called with 'info'", () => {
    const logger = createLogger("info");
    expect(logger).toBeDefined();
    expect(typeof logger.info).toBe("function");
    expect(typeof logger.error).toBe("function");
    expect(typeof logger.warn).toBe("function");
    expect(logger.level).toBe("info");
  });

  test("child logger can be created without throwing", () => {
    const logger = createLogger("info");
    const child = logger.child({ module: "test-module" });
    expect(child).toBeDefined();
    expect(typeof child.info).toBe("function");
  });

  test("accepts 'debug' level and sets it correctly", () => {
    const logger = createLogger("debug");
    expect(logger.level).toBe("debug");
  });
});
