From 7f3a7e9770623743fde1cc9fde8aea7d476a5700 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Sat, 25 Jan 2025 17:43:05 +0200 Subject: Implement line conformance validators. --- src/flatmatter.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/flatmatter.test.ts (limited to 'src/flatmatter.test.ts') diff --git a/src/flatmatter.test.ts b/src/flatmatter.test.ts new file mode 100644 index 0000000..4c349aa --- /dev/null +++ b/src/flatmatter.test.ts @@ -0,0 +1,16 @@ +import FlatMatter from "./flatmatter"; +import {assert} from "vitest"; + +test('Line has no value separator', () => { + expect(() => new FlatMatter('test')) + .toThrowError("Line on index 0 doesn't have a value separator."); +}) + +test('Line can only have one value separator', () => { + expect(() => new FlatMatter('test: this: that')) + .toThrowError("Line on index 0 has multiple value separators.") +}) + +test('String values can have colon characters', () => { + assert.doesNotThrow(() => new FlatMatter('test: "this : that"'), Error) +}) \ No newline at end of file -- cgit v1.2.3