Skip to content

Commit

Permalink
run eslint --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Sep 25, 2021
1 parent 9517936 commit 802a3ab
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 46 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand Down
1 change: 0 additions & 1 deletion lib/table-of-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function subpageUrls(parentUrl, currentPage, childPages) {
}
}


class TableOfContentsExtractor extends PersistentFilter {
constructor(folder, options) {
super(folder, options);
Expand Down
36 changes: 18 additions & 18 deletions test/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
---
Expand All @@ -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
---
Expand All @@ -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
---
Expand All @@ -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
---
Expand All @@ -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
---
Expand All @@ -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
---
Expand All @@ -102,37 +102,37 @@ 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'],
});

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'],
});

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'],
});

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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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 {
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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, {
Expand Down
12 changes: 6 additions & 6 deletions test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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(), {
Expand All @@ -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(), {
Expand Down Expand Up @@ -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(), {
Expand Down
14 changes: 7 additions & 7 deletions test/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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, {
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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, {
Expand Down
12 changes: 6 additions & 6 deletions test/relationships.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
---
Expand All @@ -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
---
Expand All @@ -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
Expand Down

0 comments on commit 802a3ab

Please sign in to comment.