blob: 9f00ef9993b8bb177f39f2e7ba38b1ee17794dbc (
plain)
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
|
import FlatMatter from "./flatmatter.ts";
import { assert } from "vitest";
import ToObject from "./serializers/to_object.ts";
test("Line has no value separator", () => {
assert.throws(
() => new FlatMatter("test"),
"Line on index 0 doesn't have a value separator."
);
});
test("Line can only have one value separator", () => {
assert.throws(
() => new FlatMatter("test: this: that"),
"Line on index 0 has multiple value separators."
);
});
test("String values can have colon characters", () => {
assert.doesNotThrow(() => new FlatMatter('test: "this : that"'), Error);
});
test("FrontMatter creates a new content entry", () => {
const fm = new FlatMatter(
`---\nthis: true\n---\n\nMarkdown goes here.\n\nAnd here.`
);
const result = fm.serialize(new ToObject());
assert.deepEqual(result, {
this: true,
content: "Markdown goes here.\n\nAnd here.",
});
});
|