test
This commit is contained in:
@@ -15,6 +15,14 @@ describe("#parseDocumentSlug", () => {
|
|||||||
).toEqual("my-doc-y4j4tR4UuV");
|
).toEqual("my-doc-y4j4tR4UuV");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should work with hash", () => {
|
||||||
|
expect(
|
||||||
|
parseDocumentSlug(
|
||||||
|
"http://mywiki.getoutline.com/doc/my-doc-y4j4tR4UuV#state"
|
||||||
|
)
|
||||||
|
).toEqual("my-doc-y4j4tR4UuV");
|
||||||
|
});
|
||||||
|
|
||||||
it("should work with subdomain qualified url", () => {
|
it("should work with subdomain qualified url", () => {
|
||||||
expect(
|
expect(
|
||||||
parseDocumentSlug("http://mywiki.getoutline.com/doc/my-doc-y4j4tR4UuV")
|
parseDocumentSlug("http://mywiki.getoutline.com/doc/my-doc-y4j4tR4UuV")
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function parseDocumentSlug(url: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const split = parsed.split("/");
|
const split = parsed.split("#")[0].split("/");
|
||||||
const indexOfDoc = split.indexOf("doc");
|
const indexOfDoc = split.indexOf("doc");
|
||||||
return split[indexOfDoc + 1] ?? undefined;
|
return split[indexOfDoc + 1] ?? undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user