/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { describe, it, expect } from "vitest"
import { parseLineIntoTokens } from "./line"
import json5 from "json5"
const lines = [
"Testing <>tagged<> items.",
"Testing how [links](knot name) work.",
"Testing ![endnotes](id-goes-here). They work like links.",
"Testing [links that don't go anywhere]",
"End notes! ![This content should link](test) to a footnote with a bigger test. (Still work in progress, exactly how the ~secondary~ content should be linked.)",
]
const errorLines = [
"Testing a dangling [link",
"Testing a [dangling url](unfinished",
"Tag left < {
it("should parse lines", () => {
for (let i = 0; i < lines.length; i++) {
const tokens = parseLineIntoTokens(lines[i])
const expectedLine = expected[i]
expect(tokens).toEqual(expectedLine)
}
})
it("should handle errors", () => {
for (let i = 0; i < errorLines.length; i++) {
const tokens = parseLineIntoTokens(errorLines[i])
const expectedLine = expectedError[i]
expect(tokens).toEqual(expectedLine)
}
})
})