-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathin_app_help.spec.ts
66 lines (62 loc) · 1.98 KB
/
in_app_help.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { describe, expect, expectTypeOf, it } from "vitest";
import { parseNoteMeta } from "./in_app_help.js";
import type NoteMeta from "./meta/note_meta.js";
describe("In-app help", () => {
it("preserves custom folder icon", () => {
const meta: NoteMeta = {
isClone: false,
noteId: "yoAe4jV2yzbd",
notePath: [ "OkOZllzB3fqN", "yoAe4jV2yzbd" ],
title: "Features",
notePosition: 40,
prefix: null,
isExpanded: false,
type: "text",
mime: "text/html",
attributes: [
{
type: "label",
name: "iconClass",
value: "bx bx-star",
isInheritable: false,
position: 10
}
],
format: "html",
attachments: [],
dirFileName: "Features",
children: []
};
const item = parseNoteMeta(meta, "/");
const icon = item?.attributes?.find((a) => a.name === "iconClass");
expect(icon?.value).toBe("bx bx-star");
});
it("hides note that is hidden from share tree", () => {
const meta: NoteMeta = {
isClone: false,
noteId: "yoAe4jV2yzbd",
notePath: [ "OkOZllzB3fqN", "yoAe4jV2yzbd" ],
title: "Features",
notePosition: 40,
prefix: null,
isExpanded: false,
type: "text",
mime: "text/html",
attributes: [
{
type: "label",
name: "shareHiddenFromTree",
value: "",
isInheritable: false,
position: 10
}
],
format: "html",
attachments: [],
dirFileName: "Features",
children: []
};
const item = parseNoteMeta(meta, "/");
expect(item).toBeFalsy();
});
});