UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

37 lines (31 loc) 705 B
import { toBoolean } from ".."; describe("toBoolean", () => { it("return boolean if input is boolean", () => { const inputs = [true, false]; expect.assertions(inputs.length); inputs.forEach((input) => { const output = toBoolean(input); expect(output).toBe(input); }); }); it("return undefined if input is not a boolean", () => { const inputs = [ "vfdvf", null, undefined, NaN, "", {}, { test: 1 }, [], [1], "true", "false", ]; expect.assertions(inputs.length); inputs.forEach((input) => { const output = toBoolean(input); expect(output).toBeUndefined(); }); }); });