-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFile.spec.ts
More file actions
27 lines (25 loc) · 850 Bytes
/
File.spec.ts
File metadata and controls
27 lines (25 loc) · 850 Bytes
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
import { dom } from "./index"
describe("dom.File", () => {
const node = new dom.File([new dom.Block.Paragraph([new dom.Inline.Text("Paragraph.")])])
it("constructor", () => expect(node).toBeTruthy())
it("create", () =>
expect(
dom.Node.create({
class: "file",
content: [{ class: "block.paragraph", content: [{ class: "inline.text", value: "Paragraph." }] }],
})
).toEqual(node))
it("class", () => expect(node.class).toBe("file"))
it("content", () => expect(node.content).toEqual([new dom.Block.Paragraph([new dom.Inline.Text("Paragraph.")])]))
it("toObject", () =>
expect(node.toObject()).toEqual({
class: "file",
content: [
{
class: "block.paragraph",
content: [{ value: "Paragraph.", class: "inline.text" }],
},
],
}))
it("toString", () => expect(node.toString()).toEqual("Paragraph."))
})