UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

33 lines (32 loc) 1.11 kB
import { createRequire } from "module"; import { describe, expect, it } from "vitest"; import { NativeTabs } from "./NativeTabs.native.js"; var require2 = createRequire(import.meta.url); function hasNativeTabsPeer() { try { require2.resolve("@bottom-tabs/react-navigation"); return true; } catch (unused) { return false; } } describe("NativeTabs optional peer", function () { it("does not throw during ordinary import-time inspection", function () { expect(function () { return Object.prototype.toString.call(NativeTabs); }).not.toThrow(); expect(function () { return Reflect.get(NativeTabs, "$$typeof"); }).not.toThrow(); expect(function () { return Reflect.get(NativeTabs, "Screen"); }).not.toThrow(); }); it("keeps the missing-peer error on actual render use", function () { if (hasNativeTabsPeer()) return; expect(function () { return NativeTabs.render({}, null); }).toThrow("NativeTabs requires @bottom-tabs/react-navigation and react-native-bottom-tabs"); }); }); //# sourceMappingURL=NativeTabs.test.native.js.map