Skip to content

Commit

Permalink
test: add more test cases
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
drazisil and coderabbitai[bot] authored Dec 16, 2024
1 parent 5b47031 commit 18e1ae0
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions utilities/logger/Logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,32 @@ describe("logging methods", () => {
});
});

describe("child loggers", () => {
it("should create child logger with custom name", () => {
const childLogger = logger.child({ name: "custom" });
expect(childLogger).toHaveProperty("info");
});
describe("child loggers", () => {
it("should create child logger with custom name", () => {
const childLogger = logger.child({ name: "custom" });
expect(childLogger).toHaveProperty("info");
expect(childLogger).toHaveProperty("debug");
expect(childLogger).toHaveProperty("warn");
expect(childLogger).toHaveProperty("error");
});

it("should create child logger with custom level", () => {
const childLogger = logger.child({ name: "custom", level: "error" });
expect(childLogger).toHaveProperty("error");
});
it("should create child logger with custom level", () => {
const childLogger = logger.child({ name: "custom", level: "error" });
expect(childLogger).toHaveProperty("error");
});

it("should inherit parent logger methods", () => {
const childLogger = logger.child({ name: "custom" });
expect(() => childLogger.info("test")).not.toThrow();
expect(() => childLogger.error("test")).not.toThrow();
});

it("should throw for invalid level", () => {
expect(() =>
logger.child({ name: "custom", level: "invalid" as any })
).toThrow();
});
});

describe("error handling", () => {
it("should handle Error objects", () => {
Expand Down

0 comments on commit 18e1ae0

Please sign in to comment.