Files
edgeever/scripts/verify-desktop-cross-version-startup.test.mjs
T
tianma-if ba56c5883c fix(desktop): accept migrated renderer origin in cross-version startup
The previous formal native already loads edgeever-app://, so the old-to-new
gate must accept that origin as well as the legacy file:// renderer.
2026-09-09 19:51:51 +08:00

23 lines
1.2 KiB
JavaScript

import { describe, expect, test } from "bun:test";
import {
CURRENT_RENDERER_URL_PREFIX,
LEGACY_RENDERER_URL_PREFIX,
isCurrentReleaseRendererUrl,
isPreviousReleaseRendererUrl,
} from "./verify-desktop-cross-version-startup.mjs";
describe("desktop cross-version startup origins", () => {
test("accepts both the legacy file origin and the current app origin for the previous native", () => {
expect(isPreviousReleaseRendererUrl(`${LEGACY_RENDERER_URL_PREFIX}/Applications/EdgeEver.app/Contents/Resources/web/index.html`)).toBe(true);
expect(isPreviousReleaseRendererUrl(`${CURRENT_RENDERER_URL_PREFIX}index.html`)).toBe(true);
expect(isPreviousReleaseRendererUrl("https://demo.edgeever.org/")).toBe(false);
expect(isPreviousReleaseRendererUrl("")).toBe(false);
});
test("requires the current custom protocol after the upgrade", () => {
expect(isCurrentReleaseRendererUrl(`${CURRENT_RENDERER_URL_PREFIX}index.html`)).toBe(true);
expect(isCurrentReleaseRendererUrl(`${LEGACY_RENDERER_URL_PREFIX}/Applications/EdgeEver.app/Contents/Resources/web/index.html`)).toBe(false);
expect(isCurrentReleaseRendererUrl("edgeever-app://other/index.html")).toBe(false);
});
});