mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-04 02:04:06 +00:00
30 lines
947 B
TypeScript
30 lines
947 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { resolvePosthogUiHost } from "./posthog-hosts";
|
|
|
|
describe("resolvePosthogUiHost", () => {
|
|
it("prefers an explicitly configured app host", () => {
|
|
// Given
|
|
const ingestionHost = "https://eu.i.posthog.com";
|
|
const uiHost = "https://posthog.example.com/";
|
|
|
|
// When / Then
|
|
expect(resolvePosthogUiHost(ingestionHost, uiHost)).toBe(
|
|
"https://posthog.example.com",
|
|
);
|
|
});
|
|
|
|
it.each([
|
|
["https://eu.i.posthog.com", "https://eu.posthog.com"],
|
|
["https://us.i.posthog.com/", "https://us.posthog.com"],
|
|
])("derives the Cloud app host from %s", (ingestionHost, expected) => {
|
|
expect(resolvePosthogUiHost(ingestionHost, null)).toBe(expected);
|
|
});
|
|
|
|
it("uses the ingestion host for a self-hosted instance", () => {
|
|
expect(
|
|
resolvePosthogUiHost("https://posthog.internal.example/", null),
|
|
).toBe("https://posthog.internal.example");
|
|
});
|
|
});
|