Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/utils/integrations/integrationsRoutePaths.test.ts
T

41 lines
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
integrationsAppPath,
integrationsCatalogPath,
integrationsSyncRunPath,
integrationsSyncsPath,
KWP_OAUTH_CALLBACK_PATH,
KWP_SETUP_PATH,
kwpMandantSelectionPath,
kwpSetupPath,
legacyIntegrationsRedirectPath,
} from "./integrationsRoutePaths";
describe("integrationsRoutePaths", () => {
it("keeps integration management inside the tenant settings workspace", () => {
expect(integrationsCatalogPath("acme")).toBe("/acme/settings/integrations");
expect(integrationsAppPath("acme", "google")).toBe("/acme/settings/integrations/google");
expect(integrationsSyncsPath("acme", "google", "connection-1")).toBe("/acme/settings/integrations/google/connection-1/syncs");
expect(integrationsSyncRunPath("acme", "google", "connection-1", "run-1")).toBe(
"/acme/settings/integrations/google/connection-1/syncs/run-1"
);
});
it("keeps the registered KWP callback fixed and encodes the setup tenant", () => {
expect(KWP_OAUTH_CALLBACK_PATH).toBe("/integrations/kwp/oauth/callback");
expect(KWP_SETUP_PATH).toBe("/integrations/kwp/setup");
expect(kwpSetupPath()).toBe(KWP_SETUP_PATH);
expect(kwpSetupPath("acme & co")).toBe("/integrations/kwp/setup?tenant=acme%20%26%20co");
expect(kwpMandantSelectionPath("acme", "connection-1")).toBe(
"/integrations/kwp/setup?tenant=acme&connection=connection-1",
);
});
it("maps legacy integration UI URLs to settings while preserving the query", () => {
expect(legacyIntegrationsRedirectPath("https://app.example.test/acme/integrations/google?tab=connections", "acme")).toBe(
"/acme/settings/integrations/google?tab=connections"
);
expect(legacyIntegrationsRedirectPath("https://app.example.test/acme/settings/integrations/google", "acme")).toBeNull();
});
});