UNPKG

@inlang/paraglide-js

Version:

[![Inlang-ecosystem compatibility badge](https://cdn.jsdelivr.net/gh/opral/monorepo@main/inlang/assets/md-badges/inlang.svg)](https://inlang.com)

27 lines (26 loc) 931 B
import { test, expect } from "vitest"; import { createParaglide } from "../create-paraglide.js"; import { newProject } from "@inlang/sdk"; test("returns a placeholder in server environment as placeholder to make dependent apis work", async () => { const runtime = await createParaglide({ blob: await newProject({ settings: { baseLocale: "en", locales: ["en", "de"], }, }), }); expect(runtime.getUrlOrigin()).toBeDefined(); }); test("returns the window.location.origin if available", async () => { const runtime = await createParaglide({ blob: await newProject({ settings: { baseLocale: "en", locales: ["en", "de"], }, }), }); globalThis.window = { location: { origin: "https://example.com" } }; expect(runtime.getUrlOrigin()).toBe("https://example.com"); });