UNPKG

one

Version:

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

34 lines (32 loc) 1.35 kB
"use strict"; var import_vitest = require("vitest"); var import_getDevServer = require("./getDevServer.native.js"); var import_getURL = require("./getURL.native"); import_vitest.vi.mock("./getDevServer", function () { return { getDevServer: import_vitest.vi.fn(function () { return { url: "http://metro.local:8081/", bundleLoadedFromServer: true }; }) }; }); var originalServerUrl = process.env.ONE_SERVER_URL; (0, import_vitest.afterEach)(function () { process.env.ONE_SERVER_URL = originalServerUrl; import_vitest.vi.clearAllMocks(); }); (0, import_vitest.describe)("getURL native", function () { (0, import_vitest.it)("prefers explicit ONE_SERVER_URL in dev", function () { process.env.ONE_SERVER_URL = "https://app.example.com/"; (0, import_vitest.expect)((0, import_getURL.getURL)()).toBe("https://app.example.com"); (0, import_vitest.expect)(import_getDevServer.getDevServer).not.toHaveBeenCalled(); }); (0, import_vitest.it)("falls back to the dev server when ONE_SERVER_URL is unset", function () { delete process.env.ONE_SERVER_URL; (0, import_vitest.expect)((0, import_getURL.getURL)()).toBe("http://metro.local:8081"); (0, import_vitest.expect)(import_getDevServer.getDevServer).toHaveBeenCalledTimes(1); }); }); //# sourceMappingURL=getURL.native.test.native.js.map