Make the existing visual test a snapshot unit test.

This commit is contained in:
Tangent Wantwight 2023-08-06 23:10:12 -04:00
parent f3eb9dee6d
commit 37df46381b
2 changed files with 213 additions and 0 deletions

View file

@ -0,0 +1,164 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Parsing Notcl Misc Big mess of markup 1`] = `
[
true,
[
[
{
"text": "h1",
},
{
"text": ""Hello,",
},
{
"text": "World!"",
},
],
[
{
"text": "para",
},
{
"text": "[2",
},
{
"text": "+",
},
{
"text": "2]",
},
],
[
{
"text": "block",
},
{
"text": "
This is a paragraph of text, with one [b bold] word. Yes, this means there has to be some magic in text processing... <b>this</b> won't work.
",
},
],
[
{
"text": "block",
},
{
"text": "-red",
},
{
"text": ""Beware!"",
},
],
[
{
"text": "para",
},
{
"text": ""All",
},
{
"text": "text",
},
{
"text": "should",
},
{
"text": "be",
},
{
"text": "quoted,",
},
{
"text": "it's",
},
{
"text": "clearer",
},
{
"text": "that",
},
{
"text": "way.",
},
{
"text": "&",
},
{
"text": "blockquotes",
},
{
"text": "already",
},
{
"text": "should",
},
{
"text": "contain",
},
{
"text": "paragraphs.",
},
{
"text": "(maybe",
},
{
"text": "normalize",
},
{
"text": "nested",
},
{
"text": "paragraphs)"",
},
],
[
{
"text": "block",
},
{
"text": "
First block
",
},
{
"text": "
Second block
Is this markdown-parsed?
[button "No we want to render UI" \\\\{noop}]
",
},
{
"text": "
Since we want escapes to work, these blocks [i will] be subject to substitutions.
",
},
],
[
{
"text": "para",
},
{
"text": "
line endings escaped one slash
not escaped if \\\\
two slashes
escaped with a slash if \\\\ three slashes
not escaped with two slashes if \\\\\\\\
four slashes
escaped with two slashes if \\\\\\\\ five slashes
not escaped with three slashes if \\\\\\\\\\\\
six slashes
",
},
],
],
]
`;

View file

@ -88,12 +88,61 @@ b`)
// nesting
// escapes
// {, }, correct newline folding
// no trailing chars
// "Quotes"
// no trailing chars
// Interpolated words
// bare
// quotes
// variables- bare, brace
// command subst
describe("Misc", () => {
test("Big mess of markup", () => {
expect(
parse(String.raw`
h1 "Hello, World!"
para [2 + 2]
block {
This is a paragraph of text, with one [b bold] word. Yes, this means there has to be some magic in text processing... <b>this</b> won't work.
}
block -red "Beware!"
para "All text should be quoted, it's clearer that way. & blockquotes already should contain paragraphs. (maybe normalize nested paragraphs)"
block {
First block
} {
Second block
Is this markdown-parsed?
[button "No we want to render UI" \\{noop}]
} {
Since we want escapes to work, these blocks [i will] be subject to substitutions.
}
# A comment
para {
line endings escaped\
one slash
not escaped if \\
two slashes
escaped with a slash if \\\
three slashes
not escaped with two slashes if \\\\
four slashes
escaped with two slashes if \\\\\
five slashes
not escaped with three slashes if \\\\\\
six slashes
}
`)
).toMatchSnapshot();
});
});
});