Files
outline/shared/utils/routeHelpers.test.ts
Tom Moor 49817d0676 fix: Document and collection mentions on public shares navigate outside the share (#13920)
On a public share, MentionDocument and MentionCollection rendered a Link to
the bare /doc/... or /collection/... path. That route is not part of the
share, so the router fell through to the authenticated app and showed the
login screen. Regular text links to the same documents were unaffected
because they go through the editor's onClickLink handler, which already
prefixes the share route.

Scope mention paths with sharedModelPath when a shareId is in context.
Moves the helper into shared/utils so the editor can use it; the app
wrapper keeps the same signature and reads ROOT_SHARE_ID from env.
2026-10-05 22:23:11 -04:00

20 lines
653 B
TypeScript

import { sharedModelPath } from "./routeHelpers";
describe("#sharedModelPath", () => {
const shareId = "1c922644-40d8-41fe-98f9-df2b67239d45";
it("should prefix the model path with the share route", () => {
expect(sharedModelPath(shareId)).toBe(`/s/${shareId}`);
expect(sharedModelPath(shareId, "/doc/test-DjDlkBi77t")).toBe(
`/s/${shareId}/doc/test-DjDlkBi77t`
);
});
it("should not prefix when the share is the root share", () => {
expect(sharedModelPath(shareId, undefined, shareId)).toBe("/");
expect(sharedModelPath(shareId, "/doc/test-DjDlkBi77t", shareId)).toBe(
"/doc/test-DjDlkBi77t"
);
});
});