one
Version:
One is a new React Framework that makes Vite serve both native and web.
25 lines (24 loc) • 963 B
JavaScript
import { createRequire } from "node:module";
import { describe, expect, it } from "vitest";
import { NativeTabs } from "./NativeTabs.mjs";
const require2 = createRequire(import.meta.url);
function hasNativeTabsPeer() {
try {
require2.resolve("@bottom-tabs/react-navigation");
return true;
} catch {
return false;
}
}
describe("NativeTabs optional peer", () => {
it("does not throw during ordinary import-time inspection", () => {
expect(() => Object.prototype.toString.call(NativeTabs)).not.toThrow();
expect(() => Reflect.get(NativeTabs, "$$typeof")).not.toThrow();
expect(() => Reflect.get(NativeTabs, "Screen")).not.toThrow();
});
it("keeps the missing-peer error on actual render use", () => {
if (hasNativeTabsPeer()) return;
expect(() => NativeTabs.render({}, null)).toThrow("NativeTabs requires @bottom-tabs/react-navigation and react-native-bottom-tabs");
});
});
//# sourceMappingURL=NativeTabs.test.mjs.map