Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/mobile/src/capacitor-config.test.ts
T

23 lines
829 B
TypeScript

import { describe, expect, it } from "vitest";
import { readLiveReloadUrl } from "../capacitor.config.js";
describe("readLiveReloadUrl", () => {
it("returns undefined when live reload is not configured", () => {
expect(readLiveReloadUrl(undefined)).toBeUndefined();
expect(readLiveReloadUrl(" ")).toBeUndefined();
});
it("preserves valid http and https URLs", () => {
expect(readLiveReloadUrl(" http://10.0.2.2:3000 ")).toBe("http://10.0.2.2:3000");
expect(readLiveReloadUrl("https://staging.example.test")).toBe("https://staging.example.test");
});
it("rejects unsupported protocols", () => {
expect(() => readLiveReloadUrl("ftp://example.test")).toThrow(/http/);
});
it("rejects relative URLs", () => {
expect(() => readLiveReloadUrl("localhost:3000")).toThrow(/absolute/);
});
});