Tests for common/logger * chore: add tests for createLogger * chore: add tests for createLogger Approved-by: Linus Flood
23 lines
827 B
TypeScript
23 lines
827 B
TypeScript
import { describe, expect, it } from "vitest"
|
|
|
|
import { shouldLog } from "./shouldLog"
|
|
|
|
describe("shouldLog", () => {
|
|
it("returns true when log level is higher or equal to minimum", () => {
|
|
expect(shouldLog("info", "debug")).toBe(true)
|
|
expect(shouldLog("info", "info")).toBe(true)
|
|
expect(shouldLog("warn", "info")).toBe(true)
|
|
expect(shouldLog("warn", "warn")).toBe(true)
|
|
expect(shouldLog("error", "error")).toBe(true)
|
|
})
|
|
|
|
it("returns false when log level is lower than minimum", () => {
|
|
expect(shouldLog("debug", "info")).toBe(false)
|
|
expect(shouldLog("debug", "warn")).toBe(false)
|
|
expect(shouldLog("debug", "error")).toBe(false)
|
|
expect(shouldLog("info", "warn")).toBe(false)
|
|
expect(shouldLog("info", "error")).toBe(false)
|
|
expect(shouldLog("warn", "error")).toBe(false)
|
|
})
|
|
})
|