-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add failing test for table-of-contents plugin
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* eslint-disable no-useless-escape */ | ||
|
||
const { createBuilder, createTempDir } = require('broccoli-test-helper'); | ||
const { expect } = require('chai'); | ||
const TableOfContents = require('../../lib/table-of-contents'); | ||
|
||
describe('table-of-contents', function () { | ||
it('should build', async function () { | ||
const input = await createTempDir(); | ||
try { | ||
// TODO why does this need to be an array of folders | ||
const subject = new TableOfContents([input.path()]); | ||
const output = createBuilder(subject); | ||
|
||
try { | ||
// INITIAL | ||
input.write({ | ||
'pages.yml': `- title: "Getting Started" | ||
url: 'getting-started' | ||
pages: | ||
- title: "How To Use The Guides" | ||
url: "intro"`, | ||
}); | ||
|
||
await output.build(); | ||
|
||
expect(output.read()).to.deep.equal({ | ||
'pages.json': '{"data":[{"type":"pages","id":"getting-started","attributes":{"title":"Getting Started","pages":[{"title":"How To Use The Guides","url":"getting-started/intro"}]}}]}', | ||
}); | ||
|
||
expect(output.changes()).to.deep.equal({ | ||
'pages.json': 'create', | ||
}); | ||
|
||
// UPDATE | ||
input.write({ | ||
'pages.yml': `- title: "Tutorial" | ||
url: 'tutorial' | ||
pages: | ||
- title: "Creating Your App" | ||
url: "ember-cli"`, // change | ||
}); | ||
await output.build(); | ||
|
||
expect(output.read()).to.deep.equal({ | ||
'pages.json': '{"data":[{"type":"pages","id":"tutorial","attributes":{"title":"Tutorial","pages":[{"title":"Creating Your App","url":"tutorial/ember-cli"}]}}]}', | ||
}); | ||
|
||
expect(output.changes()).to.deep.equal({ | ||
'pages.json': 'change', | ||
}); | ||
|
||
// NOOP | ||
await output.build(); | ||
|
||
expect(output.changes()).to.deep.equal({}); | ||
} finally { | ||
await output.dispose(); | ||
} | ||
} finally { | ||
await input.dispose(); | ||
} | ||
}); | ||
}); |