0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Add basic tests for Dictionary lists.

This commit is contained in:
David Bolack
2023-11-22 13:13:58 -06:00
parent c78dcbfe05
commit 0624f8a0b9
2 changed files with 25 additions and 0 deletions

View File

@@ -30,6 +30,7 @@
"test:mustache-syntax:inline": "jest '.*(mustache-syntax).*' -t '^Inline:.*' --verbose --noStackTrace",
"test:mustache-syntax:block": "jest '.*(mustache-syntax).*' -t '^Block:.*' --verbose --noStackTrace",
"test:mustache-syntax:injection": "jest '.*(mustache-syntax).*' -t '^Injection:.*' --verbose --noStackTrace",
"test:marked-extensions": "jest '.*(marked-extensions).*' --verbose --noStackTrace",
"test:route": "jest tests/routes/static-pages.test.js --verbose",
"phb": "node scripts/phb.js",
"prod": "set NODE_ENV=production && npm run build",

View File

@@ -0,0 +1,24 @@
/* eslint-disable max-lines */
const Markdown = require('naturalcrit/markdown.js');
describe('Dictionary Terms', ()=>{
test('Single Definition', function() {
const source = 'My term :: My First Definition';
const rendered = Markdown.render(source);
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>My term</dt><dd>My First Definition</dd></dl>');
});
test('Two Definitions', function() {
const source = 'My term :: My First Definition :: My Second Definition';
const rendered = Markdown.render(source);
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>My term</dt><dd>My First Definition</dd>\n<dd>My Second Definition</dd></dl>');
});
test('Three Definitions', function() {
const source = 'My term :: My First Definition :: My Second Definition :: My Third Definition';
const rendered = Markdown.render(source);
expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('<dl><dt>My term</dt><dd>My First Definition</dd>\n<dd>My Second Definition</dd>\n<dd>My Third Definition</dd></dl>');
});
});