-
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.
- Loading branch information
Showing
10 changed files
with
84 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export {default as scaffold} from './scaffold'; | ||
export {default as scaffold} from './scaffolder'; |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {promises as fs} from 'fs'; | ||
import {assert} from 'chai'; | ||
import sinon from 'sinon'; | ||
import any from '@travi/any'; | ||
import scaffold from './scaffolder'; | ||
|
||
suite('scaffolder', () => { | ||
let sandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.createSandbox(); | ||
|
||
sandbox.stub(fs, 'writeFile'); | ||
}); | ||
|
||
teardown(() => sandbox.restore()); | ||
|
||
test('that the presentation is scaffolded', async () => { | ||
const projectRoot = any.string(); | ||
|
||
const {scripts} = await scaffold({projectRoot}); | ||
|
||
assert.calledWith(fs.writeFile, `${projectRoot}/slides.md`, ''); | ||
assert.deepEqual( | ||
scripts, | ||
{ | ||
dev: 'slidev', | ||
build: 'slidev build', | ||
export: 'slidev export' | ||
} | ||
); | ||
}); | ||
}); |
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,13 @@ | ||
import {promises as fs} from 'fs'; | ||
|
||
export default async function ({projectRoot}) { | ||
await fs.writeFile(`${projectRoot}/slides.md`, ''); | ||
|
||
return { | ||
scripts: { | ||
dev: 'slidev', | ||
build: 'slidev build', | ||
export: 'slidev export' | ||
} | ||
}; | ||
} |
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
18 changes: 18 additions & 0 deletions
18
test/integration/features/step_definitions/scaffold-steps.js
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,18 @@ | ||
import {Then} from '@cucumber/cucumber'; | ||
import {assert} from 'chai'; | ||
import {fileExists} from '@form8ion/core'; | ||
|
||
Then('the expected files are generated', async function () { | ||
assert.isTrue(await fileExists(`${process.cwd()}/slides.md`)); | ||
}); | ||
|
||
Then('the scripts are defined', async function () { | ||
assert.deepEqual( | ||
this.results.scripts, | ||
{ | ||
dev: 'slidev', | ||
build: 'slidev build', | ||
export: 'slidev export' | ||
} | ||
); | ||
}); |