Merged in chore/create-logger-tests (pull request #2996)
Tests for common/logger * chore: add tests for createLogger * chore: add tests for createLogger Approved-by: Linus Flood
This commit is contained in:
22
packages/common/logger/createLogger/shouldLog.test.ts
Normal file
22
packages/common/logger/createLogger/shouldLog.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user