vitest(link): add Vitest test cases for parseNavigationStateFromUrl

This commit is contained in:
SiriusXT 2025-06-10 17:38:05 +08:00
parent 885cdc8c97
commit ee9267775e

View File

@ -22,6 +22,11 @@ describe("Link", () => {
expect(output).toMatchObject({ notePath: "root/WWaBNf3SSA1b/mQ2tIzLVFKHL", noteId: "mQ2tIzLVFKHL" }); expect(output).toMatchObject({ notePath: "root/WWaBNf3SSA1b/mQ2tIzLVFKHL", noteId: "mQ2tIzLVFKHL" });
}); });
it("parses notePath with extraWindow", () => {
const output = parseNavigationStateFromUrl(`127.0.0.1:8080/?extraWindow=1#root/QZGqKB7wVZF8?ntxId=0XPvXG`);
expect(output).toMatchObject({ notePath: "root/QZGqKB7wVZF8", noteId: "QZGqKB7wVZF8" });
});
it("ignores external URL with internal hash anchor", () => { it("ignores external URL with internal hash anchor", () => {
const output = parseNavigationStateFromUrl(`https://en.wikipedia.org/wiki/Bearded_Collie#Health`); const output = parseNavigationStateFromUrl(`https://en.wikipedia.org/wiki/Bearded_Collie#Health`);
expect(output).toMatchObject({}); expect(output).toMatchObject({});