-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from x-govuk/node-test
Use Node test runner
- Loading branch information
Showing
9 changed files
with
52 additions
and
1,155 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
desc: Converts Markdown into GOV.UK Frontend-compliant HTML | ||
--- | ||
|
||
. | ||
# Heading 1 | ||
. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
desc: Improves typography (fractions only) | ||
--- | ||
|
||
. | ||
1/2 2/3 | ||
. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
desc: Improves typography (guillemets only) | ||
--- | ||
|
||
. | ||
1/2 2/3 | ||
. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
desc: Improves typography (mathematical symbols only) | ||
--- | ||
|
||
. | ||
1/2 2/3 | ||
. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
desc: Improves all typography | ||
--- | ||
|
||
. | ||
1/2 2/3 | ||
. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
desc: Starts headings with xl size | ||
--- | ||
|
||
. | ||
# Heading 1 | ||
. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,36 @@ | ||
const { describe } = require('mocha') | ||
const assert = require('node:assert') | ||
const { it, describe } = require('node:test') | ||
const testGenerator = require('markdown-it-testgen') | ||
const markdownIt = require('markdown-it') | ||
|
||
describe('Converts Markdown into GOV.UK Frontend-compliant HTML', () => { | ||
const md = require('markdown-it')().use(require('../index.js')) | ||
// `testGenerator` uses Mocha internally, but we’re using node:test | ||
global.describe = describe | ||
global.it = it | ||
|
||
testGenerator('./test/fixtures/govuk.txt', md) | ||
}) | ||
|
||
describe('Starts headings with xl size', () => { | ||
const md = require('markdown-it')().use(require('../index.js'), { | ||
headingsStartWith: 'xl' | ||
}) | ||
const testMarkdown = (path, options = {}) => { | ||
const md = markdownIt().use(require('../index.js'), options) | ||
|
||
testGenerator('./test/fixtures/option-heading-starts-with.txt', md) | ||
}) | ||
testGenerator(path, { assert }, md) | ||
} | ||
|
||
describe('Improves all typography', () => { | ||
const md = require('markdown-it')().use(require('../index.js'), { | ||
calvert: true | ||
}) | ||
testMarkdown('./test/fixtures/govuk.txt') | ||
|
||
testGenerator('./test/fixtures/option-calvert.txt', md) | ||
testMarkdown('./test/fixtures/option-heading-starts-with.txt', { | ||
headingsStartWith: 'xl' | ||
}) | ||
|
||
describe('Improves typography (fractions only)', () => { | ||
const md = require('markdown-it')().use(require('../index.js'), { | ||
calvert: ['fractions'] | ||
}) | ||
|
||
testGenerator('./test/fixtures/option-calvert-fractions.txt', md) | ||
testMarkdown('./test/fixtures/option-calvert.txt', { | ||
calvert: true | ||
}) | ||
|
||
describe('Improves typography (guillemets only)', () => { | ||
const md = require('markdown-it')().use(require('../index.js'), { | ||
calvert: ['guillemets'] | ||
}) | ||
|
||
testGenerator('./test/fixtures/option-calvert-guillemets.txt', md) | ||
testMarkdown('./test/fixtures/option-calvert-fractions.txt', { | ||
calvert: ['fractions'] | ||
}) | ||
|
||
describe('Improves typography (mathematical symbols only)', () => { | ||
const md = require('markdown-it')().use(require('../index.js'), { | ||
calvert: ['mathematical'] | ||
}) | ||
testMarkdown('./test/fixtures/option-calvert-guillemets.txt', { | ||
calvert: ['guillemets'] | ||
}) | ||
|
||
testGenerator('./test/fixtures/option-calvert-mathematical.txt', md) | ||
testMarkdown('./test/fixtures/option-calvert-mathematical.txt', { | ||
calvert: ['mathematical'] | ||
}) |