feat: add explorer sidebar, account menu and preview preferences
This commit is contained in:
1 parent
b87f8cb961
commit
fa1832dfa7
22 files changed
+929
-226
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseBookmarks } from "../bookmarks";
|
||||
describe("folder bookmarks", () => {
|
||||
it("handles unavailable, corrupt or unrelated storage", () => {
|
||||
for (const value of [null, "broken", "{}", '"string"'])
|
||||
expect(parseBookmarks(value)).toEqual([]);
|
||||
});
|
||||
it("keeps unique file locations and rejects external URLs", () => {
|
||||
expect(
|
||||
parseBookmarks(
|
||||
JSON.stringify([
|
||||
{ name: "Scans", url: "/files/scans/" },
|
||||
{ name: "Duplicate", url: "/files/scans/" },
|
||||
{ name: "Wrong", url: "https://example.com" },
|
||||
{ name: "Wrong", url: "/files-other/" },
|
||||
{ name: "Wrong", url: "/files/a/?secret=1" },
|
||||
null,
|
||||
])
|
||||
)
|
||||
).toEqual([{ name: "Scans", url: "/files/scans/" }]);
|
||||
});
|
||||
it("bounds the number and length of bookmarks", () => {
|
||||
const entries = parseBookmarks(
|
||||
JSON.stringify(
|
||||
Array.from({ length: 80 }, (_, i) => ({
|
||||
name: "a".repeat(500),
|
||||
url: `/files/${i}/`,
|
||||
}))
|
||||
)
|
||||
);
|
||||
expect(entries).toHaveLength(40);
|
||||
expect(entries[0].name).toHaveLength(255);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user