mirror of
https://github.com/chenasraf/simple-scaffold.git
synced 2026-05-17 17:28:09 +00:00
22 lines
595 B
TypeScript
22 lines
595 B
TypeScript
import { handleErr, resolve } from "../src/utils"
|
|
|
|
describe("utils", () => {
|
|
describe("resolve", () => {
|
|
test("should resolve function", () => {
|
|
expect(resolve(() => 1, null)).toBe(1)
|
|
expect(resolve((x) => x, 2)).toBe(2)
|
|
})
|
|
test("should resolve value", () => {
|
|
expect(resolve(1, null)).toBe(1)
|
|
expect(resolve(2, 1)).toBe(2)
|
|
})
|
|
})
|
|
|
|
describe("handleErr", () => {
|
|
test("should throw error", () => {
|
|
expect(() => handleErr({ name: "test", message: "test" })).toThrow()
|
|
expect(() => handleErr(null as never)).not.toThrow()
|
|
})
|
|
})
|
|
})
|