From 0624f8a0b962f3b1c8e397d4c4762e1863691e18 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Wed, 22 Nov 2023 13:13:58 -0600 Subject: [PATCH] Add basic tests for Dictionary lists. --- package.json | 1 + tests/markdown/marked-extensions.test.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/markdown/marked-extensions.test.js diff --git a/package.json b/package.json index cd2b446ba..2ee0c8c12 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/markdown/marked-extensions.test.js b/tests/markdown/marked-extensions.test.js new file mode 100644 index 000000000..52f2da38f --- /dev/null +++ b/tests/markdown/marked-extensions.test.js @@ -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('
My term
My First Definition
'); + }); + + 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('
My term
My First Definition
\n
My Second Definition
'); + }); + + 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('
My term
My First Definition
\n
My Second Definition
\n
My Third Definition
'); + }); + +});