Skip to content

Commit cccb1dd

Browse files
committed
test: generate _sidebar.md
1 parent c807229 commit cccb1dd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

e2e/commands/generate.test.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const test = require('ava')
2+
const fs = require('fs')
3+
const path = require('path')
4+
5+
const {run} = require('../helpers/test-utils.js')
6+
7+
const genPath = path.join(__dirname, 'generate-cmd')
8+
const docsPath = path.join(genPath, 'docs')
9+
10+
test.before('create temp directory', () => {
11+
// Cleanup if the directory already exists
12+
if (fs.existsSync(genPath)) {
13+
fs.rmdirSync(genPath, {recursive: true})
14+
}
15+
16+
fs.mkdirSync(genPath)
17+
})
18+
19+
test.after('cleanup', () => {
20+
fs.rmdirSync(genPath, {recursive: true})
21+
})
22+
23+
test('generate _sidebar.md', t => {
24+
run(['init', 'docs'], {cwd: genPath})
25+
run(['generate', 'docs'], {cwd: genPath})
26+
// Check for existence
27+
t.true(fs.existsSync(path.join(docsPath, '_sidebar.md')))
28+
})

0 commit comments

Comments
 (0)