app/utils/routeHelpers.test.ts
Rama main · réplica de lectura del repositorio original.
import { sharedModelPath, desktopify } from "./routeHelpers";
describe("#sharedDocumentPath", () => {
it("should return share path for a document", () => {
const shareId = "1c922644-40d8-41fe-98f9-df2b67239d45";
const docPath = "/doc/test-DjDlkBi77t";
expect(sharedModelPath(shareId)).toBe(
"/s/1c922644-40d8-41fe-98f9-df2b67239d45"
);
expect(sharedModelPath(shareId, docPath)).toBe(
"/s/1c922644-40d8-41fe-98f9-df2b67239d45/doc/test-DjDlkBi77t"
);
});
});
describe("#desktopify", () => {
it("should replace https protocol with outline://", () => {
expect(
desktopify("/doc/test-DjDlkBi77t", "https://app.getoutline.com")
).toBe("outline://app.getoutline.com/doc/test-DjDlkBi77t");
});
it("should replace http protocol with outline://", () => {
expect(desktopify("/doc/test-DjDlkBi77t", "http://localhost:3000")).toBe(
"outline://localhost:3000/doc/test-DjDlkBi77t"
);
});
});