:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { describe, expect, it } from "vitest";
import { rewriteSavedLocation } from "./route-migrations";
describe("rewriteSavedLocation", () => {
it("normalizes root rewrites to one leading slash", () => {
expect(rewriteSavedLocation("/website/home//tasks/123")).toBe("/tasks/123");
});
it("preserves query and hash suffixes on root rewrites", () => {
expect(rewriteSavedLocation("/website/home?tab=recent")).toBe(
"/?tab=recent",
);
expect(rewriteSavedLocation("/website/home#section")).toBe("/#section");
});
});