UNPKG

one

Version:

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

43 lines (42 loc) 1.98 kB
import { describe, expect, it } from "vitest"; import { normalizeLinkingConfig } from "../link/getLinking.native.js"; import { getRoutes } from "./getRoutes.native.js"; import { getLinkingConfig } from "./getLinkingConfig.native.js"; import { getMockContext } from "../testing-utils.native.js"; describe("getLinkingConfig", function () { it("expands configured schemes into prefixes", function () { var routes = getRoutes(getMockContext(["_layout.tsx", "index.tsx"])); var linking = getLinkingConfig(routes, true, { scheme: "threepunchconvo" }); expect(linking.prefixes).toEqual(["threepunchconvo://", "threepunchconvo:///"]); }); it("merges explicit prefixes with scheme-derived prefixes", function () { var routes = getRoutes(getMockContext(["_layout.tsx", "index.tsx"])); var linking = getLinkingConfig(routes, true, { scheme: "threepunchconvo", prefixes: ["threepunchconvo://app"] }); expect(linking.prefixes).toEqual(["threepunchconvo://", "threepunchconvo:///", "threepunchconvo://app"]); }); }); describe("normalizeLinkingConfig", function () { it("merges manifest-default prefixes with user-supplied scheme/prefixes", function () { var result = normalizeLinkingConfig({ scheme: "foo", prefixes: ["https://example.test/app"] }, ["bar://", "bar:///"]); expect(result.prefixes).toEqual(["bar://", "bar:///", "foo://", "foo:///", "https://example.test/app"]); }); it("falls back to manifest-default prefixes when nothing is configured", function () { var result = normalizeLinkingConfig(void 0, ["bar://", "bar:///"]); expect(result.prefixes).toEqual(["bar://", "bar:///"]); }); it("dedupes overlapping defaults and configured prefixes", function () { var result = normalizeLinkingConfig({ scheme: "foo" }, ["foo://", "foo:///"]); expect(result.prefixes).toEqual(["foo://", "foo:///"]); }); }); //# sourceMappingURL=getLinkingConfig.test.native.js.map