diff --git a/index.js b/index.js index 9fb4766..68ee6db 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,6 @@ const TableOfContents = require('./lib/table-of-contents'); const CollateJsonApiBlobs = require('./lib/collate-and-paginate'); const MarkdownToJsonApi = require('./lib/markdown-to-jsonapi'); - class EmptyNode extends Plugin { constructor() { super([]); diff --git a/lib/table-of-contents.js b/lib/table-of-contents.js index 3546652..d5fa39a 100644 --- a/lib/table-of-contents.js +++ b/lib/table-of-contents.js @@ -26,7 +26,6 @@ function subpageUrls(parentUrl, currentPage, childPages) { } } - class TableOfContentsExtractor extends PersistentFilter { constructor(folder, options) { super(folder, options); diff --git a/test/attributes.js b/test/attributes.js index 86719e8..a8c8fc5 100644 --- a/test/attributes.js +++ b/test/attributes.js @@ -21,12 +21,12 @@ async function buildSingleFile(fileContents, options) { return indexJSON.data; } -describe('JSONAPI attributes', () => { - beforeEach(async () => { +describe('JSONAPI attributes', function () { + beforeEach(async function () { input = await createTempDir(); }); - afterEach(async () => { + afterEach(async function () { try { await input.dispose(); } finally { @@ -38,7 +38,7 @@ describe('JSONAPI attributes', () => { } }); - it('should not include title if the frontmatter is included but no options passed', async () => { + it('should not include title if the frontmatter is included but no options passed', async function () { const result = await buildSingleFile(`--- title: a lovely title --- @@ -48,7 +48,7 @@ title: a lovely title expect(result.attributes).have.property('content', '# Hello world'); }); - it('should include title if the frontmatter is included and title is in attributes', async () => { + it('should include title if the frontmatter is included and title is in attributes', async function () { const result = await buildSingleFile(`--- title: a lovely title --- @@ -60,7 +60,7 @@ title: a lovely title expect(result.attributes).have.property('content', '# Hello world'); }); - it('should not inlude any extra frontmatter that is not defined in attributes', async () => { + it('should not inlude any extra frontmatter that is not defined in attributes', async function () { const result = await buildSingleFile(`--- unknown: some unknown frontmatter --- @@ -69,7 +69,7 @@ unknown: some unknown frontmatter expect(result.attributes).to.not.have.property('unknown'); }); - it('should allow you to specify attributes and for them to be included in the output', async () => { + it('should allow you to specify attributes and for them to be included in the output', async function () { const result = await buildSingleFile(`--- known: some frontmatter --- @@ -80,7 +80,7 @@ known: some frontmatter expect(result.attributes).to.have.property('known', 'some frontmatter'); }); - it('should make the frontmatter description take precedent if attribute description is specified', async () => { + it('should make the frontmatter description take precedent if attribute description is specified', async function () { const result = await buildSingleFile(`--- description: use me instead --- @@ -91,7 +91,7 @@ description: use me instead expect(result.attributes).to.have.property('description', 'use me instead'); }); - it('should make the frontmatter description take precedent if contentType description is specified', async () => { + it('should make the frontmatter description take precedent if contentType description is specified', async function () { const result = await buildSingleFile(`--- description: use me instead --- @@ -102,13 +102,13 @@ description: use me instead expect(result.attributes).to.have.property('description', 'use me instead'); }); - it('should only include html and content with basic config', async () => { + it('should only include html and content with basic config', async function () { const result = await buildSingleFile('# Hello world'); expect(result.attributes).have.keys(['html', 'content']); }); - it('should not include html if it is not in the content types', async () => { + it('should not include html if it is not in the content types', async function () { const result = await buildSingleFile('# Hello world', { contentTypes: ['content'], }); @@ -116,7 +116,7 @@ description: use me instead expect(result.attributes).have.keys(['content']); }); - it('should not include markdown if it is not in the content types', async () => { + it('should not include markdown if it is not in the content types', async function () { const result = await buildSingleFile('# Hello world', { contentTypes: ['html'], }); @@ -124,7 +124,7 @@ description: use me instead expect(result.attributes).have.keys(['html']); }); - it('should include description if it is defined in config', async () => { + it('should include description if it is defined in config', async function () { const result = await buildSingleFile('# Hello world', { contentTypes: ['html', 'content', 'description'], }); @@ -132,7 +132,7 @@ description: use me instead expect(result.attributes).have.keys(['html', 'content', 'description']); }); - it('should limit description to 260 characters', async () => { + it('should limit description to 260 characters', async function () { const result = await buildSingleFile(`# Hello world This is where I write my really long essay to the world. I will start off bing **super** important and then _slow down_ to a stop. @@ -146,7 +146,7 @@ I really like programming. I could do this all day long without ever stooopping, expect(result.attributes.description).to.have.lengthOf.at.most(260); }); - it('should end the description with ... when the content is limited', async () => { + it('should end the description with ... when the content is limited', async function () { const result = await buildSingleFile(`# Hello world This is where I write my really long essay to the world. I will start off bing **super** important and then _slow down_ to a stop. @@ -160,7 +160,7 @@ I really like programming. I could do this all day long without ever stooopping, expect(result.attributes.description).to.match(/\.\.\.$/); }); - it('should not end the description with ... when the content is not limited', async () => { + it('should not end the description with ... when the content is not limited', async function () { const result = await buildSingleFile(`# Hello world This is where I write my really long essay to the world. I will start off bing **super** important and then _slow down_ to a stop. @@ -171,7 +171,7 @@ This is where I write my really long essay to the world. I will start off bing * expect(result.attributes.description).to.not.match(/\.\.\.$/); }); - it('should throw an error if there is an unknown content type', async () => { + it('should throw an error if there is an unknown content type', async function () { let error; try { @@ -186,7 +186,7 @@ This is where I write my really long essay to the world. I will start off bing * expect(error.message).to.equal('Unknown content type: faceyFace'); }); - it('should include page table of contents if included in contentTypes', async () => { + it('should include page table of contents if included in contentTypes', async function () { const result = await buildSingleFile(`# Hello world This is the first part diff --git a/test/collections.js b/test/collections.js index c1569a6..5170151 100644 --- a/test/collections.js +++ b/test/collections.js @@ -29,12 +29,12 @@ async function buildFiles(files, options) { return outputFiles; } -describe('collections', () => { - beforeEach(async () => { +describe('collections', function () { + beforeEach(async function () { input = await createTempDir(); }); - afterEach(async () => { + afterEach(async function () { try { await input.dispose(); } finally { @@ -46,7 +46,7 @@ describe('collections', () => { } }); - it('should have the same ids for collection objects as it does for individual objects', async () => { + it('should have the same ids for collection objects as it does for individual objects', async function () { const files = await buildFiles({ 'index.md': `--- title: a lovely title @@ -74,7 +74,7 @@ title: more words expect(files['all.json'].find((obj) => obj.id === 'double-word')).to.be.ok; }); - it('should allow you to define a collection and for the specified content folder to be exported as an single JSONAPI array response', async () => { + it('should allow you to define a collection and for the specified content folder to be exported as an single JSONAPI array response', async function () { const subject = new StaticSiteJson(input.path(), { attributes: ['title'], type: 'page', @@ -131,7 +131,7 @@ title: more words }); }); - it('should still generate the all.json even if there is only one input file', async () => { + it('should still generate the all.json even if there is only one input file', async function () { const subject = new StaticSiteJson(input.path(), { attributes: ['title'], type: 'page', @@ -165,7 +165,7 @@ title: a lovely title }); }); - it('should work if a broccoli plugin is passed in instead of a folder', async () => { + it('should work if a broccoli plugin is passed in instead of a folder', async function () { const mdFiles = new Funnel(input.path(), { destDir: 'face' }); const subject = new StaticSiteJson(mdFiles, { diff --git a/test/core.js b/test/core.js index 5efd36e..32f3aa9 100644 --- a/test/core.js +++ b/test/core.js @@ -42,7 +42,7 @@ describe('core functionality', function () { await input.dispose(); }); - it('should ignore non .md files', async () => { + it('should ignore non .md files', async function () { const input = await createTempDir(); const subject = new StaticSiteJson(input.path()); @@ -64,7 +64,7 @@ describe('core functionality', function () { await input.dispose(); }); - it('should work recursively', async () => { + it('should work recursively', async function () { const input = await createTempDir(); const subject = new StaticSiteJson(input.path()); @@ -96,7 +96,7 @@ describe('core functionality', function () { await input.dispose(); }); - it('should work with a broccoli plugin as an input', async () => { + it('should work with a broccoli plugin as an input', async function () { const input = await createTempDir(); const mdFiles = new Funnel(input.path()); @@ -130,7 +130,7 @@ describe('core functionality', function () { await input.dispose(); }); - it('should allow you to specify the destination directoy with contentFolder', async () => { + it('should allow you to specify the destination directoy with contentFolder', async function () { const input = await createTempDir(); const subject = new StaticSiteJson(input.path(), { @@ -152,7 +152,7 @@ describe('core functionality', function () { await input.dispose(); }); - it('should allow you to override the JSON:API type', async () => { + it('should allow you to override the JSON:API type', async function () { const input = await createTempDir(); const subject = new StaticSiteJson(input.path(), { @@ -183,7 +183,7 @@ describe('core functionality', function () { await input.dispose(); }); - it('should read pages.yaml and produce the TOC pages.json file', async () => { + it('should read pages.yaml and produce the TOC pages.json file', async function () { const input = await createTempDir(); const subject = new StaticSiteJson(input.path(), { diff --git a/test/pagination.js b/test/pagination.js index d8ace1c..5633ec2 100644 --- a/test/pagination.js +++ b/test/pagination.js @@ -7,12 +7,12 @@ const StaticSiteJson = require('../index'); let output; let input; -describe('pagination', () => { - beforeEach(async () => { +describe('pagination', function () { + beforeEach(async function () { input = await createTempDir(); }); - afterEach(async () => { + afterEach(async function () { try { await input.dispose(); } finally { @@ -24,7 +24,7 @@ describe('pagination', () => { } }); - it('should allow you to specify page size with pagination', async () => { + it('should allow you to specify page size with pagination', async function () { const mdFiles = new Funnel(input.path(), { destDir: 'face' }); const subject = new StaticSiteJson(mdFiles, { @@ -66,7 +66,7 @@ title: more words expect(JSON.parse(folderOutput.content['all.json']).data).to.have.length(2); }); - it('should automatically paginate 10 files when pagination is turned on', async () => { + it('should automatically paginate 10 files when pagination is turned on', async function () { const mdFiles = new Funnel(input.path(), { destDir: 'face' }); const subject = new StaticSiteJson(mdFiles, { @@ -136,7 +136,7 @@ title: duplicate expect(JSON.parse(folderOutput.content['all-1.json']).data).to.have.length(2); }); - it('should setup pagination links correctly', async () => { + it('should setup pagination links correctly', async function () { const mdFiles = new Funnel(input.path(), { destDir: 'face' }); const subject = new StaticSiteJson(mdFiles, { @@ -222,7 +222,7 @@ title: duplicate }); }); - it('should prefix pagination links with the right contentFolder', async () => { + it('should prefix pagination links with the right contentFolder', async function () { const mdFiles = new Funnel(input.path(), { destDir: 'face' }); const subject = new StaticSiteJson(mdFiles, { diff --git a/test/relationships.js b/test/relationships.js index e8cc497..b9f3da7 100644 --- a/test/relationships.js +++ b/test/relationships.js @@ -21,12 +21,12 @@ async function buildSingleFile(fileContents, options) { return indexJSON.data; } -describe('references or relationships', () => { - beforeEach(async () => { +describe('references or relationships', function () { + beforeEach(async function () { input = await createTempDir(); }); - afterEach(async () => { + afterEach(async function () { try { await input.dispose(); } finally { @@ -38,7 +38,7 @@ describe('references or relationships', () => { } }); - it('should not include relationship for tag if the frontmatter is included but no options passed', async () => { + it('should not include relationship for tag if the frontmatter is included but no options passed', async function () { const result = await buildSingleFile(`--- tag: face --- @@ -47,7 +47,7 @@ tag: face expect(result).not.have.property('relationships'); }); - it('should include title if the frontmatter is included and title is in attributes', async () => { + it('should include title if the frontmatter is included and title is in attributes', async function () { const result = await buildSingleFile(`--- tag: face --- @@ -60,7 +60,7 @@ tag: face expect(result.relationships.tag.data).have.property('type', 'tags'); }); - it('should allow you to customize the type of relationship', async () => { + it('should allow you to customize the type of relationship', async function () { const result = await buildSingleFile(`--- tag: face profile: face.jpg