diff --git a/lib/test/wrapperData.test.ts b/lib/test/wrapperData.test.ts index 5a35ece..1be474d 100644 --- a/lib/test/wrapperData.test.ts +++ b/lib/test/wrapperData.test.ts @@ -11,101 +11,108 @@ const todo = (): A => { } const noop = () => {} describe("wrapperData", () => { - test.skip("types", async () => { - utils(todo()).setOwnWrapperData("/config", { - someValue: "a", - }) - utils(todo()).setOwnWrapperData( - "/config/someValue", - "b", - ) - utils(todo()).setOwnWrapperData("", { - config: { someValue: "b" }, - }) - utils(todo()).setOwnWrapperData( - "/config/someValue", + test("types", async () => { + ;async () => { + utils(todo()).setOwnWrapperData("/config", { + someValue: "a", + }) + utils(todo()).setOwnWrapperData( + "/config/someValue", + "b", + ) + utils(todo()).setOwnWrapperData("", { + config: { someValue: "b" }, + }) + utils(todo()).setOwnWrapperData( + "/config/someValue", - // @ts-expect-error Type is wrong for the setting value - 5, - ) - utils(todo()).setOwnWrapperData( - // @ts-expect-error Path is wrong - "/config/someVae3lue", - "someValue", - ) + // @ts-expect-error Type is wrong for the setting value + 5, + ) + utils(todo()).setOwnWrapperData( + // @ts-expect-error Path is wrong + "/config/someVae3lue", + "someValue", + ) - todo().setWrapperData({ - path: "/config/someValue", - value: "b", - }) - todo().setWrapperData({ - //@ts-expect-error Path is wrong - path: "/config/someValue", - //@ts-expect-error Path is wrong - value: "someValueIn", - }) - todo().setWrapperData({ - //@ts-expect-error Path is wrong - path: "/config/some2Value", - value: "a", - }) - ;(await utils(todo()) - .getOwnWrapperData("/config/someValue") - .const()) satisfies string - ;(await utils(todo()) - .getOwnWrapperData("/config") - .const()) satisfies WrapperType["config"] - await utils(todo()) - // @ts-expect-error Path is wrong - .getOwnWrapperData("/config/somdsfeValue") - .const() - /// ----------------- ERRORS ----------------- + todo().setWrapperData({ + path: "/config/someValue", + value: "b", + }) + todo().setWrapperData({ + //@ts-expect-error Path is wrong + path: "/config/someValue", + //@ts-expect-error Path is wrong + value: "someValueIn", + }) + todo().setWrapperData({ + //@ts-expect-error Path is wrong + path: "/config/some2Value", + value: "a", + }) + ;(await utils(todo()) + .getOwnWrapperData("/config/someValue") + .const()) satisfies string + ;(await utils(todo()) + .getOwnWrapperData("/config") + .const()) satisfies WrapperType["config"] + await utils(todo()) + // @ts-expect-error Path is wrong + .getOwnWrapperData("/config/somdsfeValue") + .const() + /// ----------------- ERRORS ----------------- - utils(todo()).setOwnWrapperData("", { - // @ts-expect-error Type is wrong for the setting value - config: { someValue: "notInAOrB" }, - }) - utils(todo()).setOwnWrapperData( - "/config/someValue", - // @ts-expect-error Type is wrong for the setting value - "notInAOrB", - ) - ;(await utils(todo()) - .getOwnWrapperData("/config/someValue") - // @ts-expect-error Const should normally not be callable - .const()) satisfies string - ;(await utils(todo()) - .getOwnWrapperData("/config") - // @ts-expect-error Const should normally not be callable - .const()) satisfies WrapperType["config"] - await utils(todo()) - // @ts-expect-error Path is wrong - .getOwnWrapperData("/config/somdsfeValue") - // @ts-expect-error Const should normally not be callable - .const() + utils(todo()).setOwnWrapperData("", { + // @ts-expect-error Type is wrong for the setting value + config: { someValue: "notInAOrB" }, + }) + utils(todo()).setOwnWrapperData( + "/config/someValue", + // @ts-expect-error Type is wrong for the setting value + "notInAOrB", + ) + ;(await utils(todo()) + .getOwnWrapperData("/config/someValue") + // @ts-expect-error Const should normally not be callable + .const()) satisfies string + ;(await utils(todo()) + .getOwnWrapperData("/config") + // @ts-expect-error Const should normally not be callable + .const()) satisfies WrapperType["config"] + await utils(todo()) + // @ts-expect-error Path is wrong + .getOwnWrapperData("/config/somdsfeValue") + // @ts-expect-error Const should normally not be callable + .const() - /// - ;(await utils(todo()) - .getOwnWrapperData("/config/someValue") - // @ts-expect-error satisfies type is wrong - .const()) satisfies number - ;(await utils(todo()) - // @ts-expect-error Path is wrong - .getOwnWrapperData("/config/") - .const()) satisfies WrapperType["config"] - ;(await todo().getWrapperData({ - path: "/config/someValue", - callback: noop, - })) satisfies string - await todo().getWrapperData({ - // @ts-expect-error Path is wrong as in it doesn't match above - path: "/config/someV2alue", - callback: noop, - }) - await todo().getWrapperData({ - // @ts-expect-error Path is wrong as in it doesn't exists in wrapper type - path: "/config/someV2alue", - callback: noop, - }) + /// + ;(await utils(todo()) + .getOwnWrapperData("/config/someValue") + // @ts-expect-error satisfies type is wrong + .const()) satisfies number + ;(await utils(todo()) + // @ts-expect-error Path is wrong + .getOwnWrapperData("/config/") + .const()) satisfies WrapperType["config"] + ;(await todo().getWrapperData< + WrapperType, + "/config/someValue" + >({ + path: "/config/someValue", + callback: noop, + })) satisfies string + await todo().getWrapperData({ + // @ts-expect-error Path is wrong as in it doesn't match above + path: "/config/someV2alue", + callback: noop, + }) + await todo().getWrapperData( + { + // @ts-expect-error Path is wrong as in it doesn't exists in wrapper type + path: "/config/someV2alue", + callback: noop, + }, + ) + } }) })