summaryrefslogtreecommitdiff
path: root/src/flatmatter.test.ts
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2025-01-28 21:29:22 +0200
committerAsko Nõmm <asko@nmm.ee>2025-01-28 21:29:22 +0200
commit95692cf5540f1c0777ec08464ad5cc2a420406d6 (patch)
tree2746ecd1664ae1679d019d2d697aa6a092782e76 /src/flatmatter.test.ts
parent8a53d6c1870533c5020b00a509025293caa2637e (diff)
Improve docs, namings
Diffstat (limited to 'src/flatmatter.test.ts')
-rw-r--r--src/flatmatter.test.ts41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/flatmatter.test.ts b/src/flatmatter.test.ts
index bbe26d9..9f00ef9 100644
--- a/src/flatmatter.test.ts
+++ b/src/flatmatter.test.ts
@@ -1,22 +1,33 @@
import FlatMatter from "./flatmatter.ts";
-import {assert} from "vitest";
+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 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("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("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());
+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."});
-}) \ No newline at end of file
+ assert.deepEqual(result, {
+ this: true,
+ content: "Markdown goes here.\n\nAnd here.",
+ });
+});