Skip to content

Commit

Permalink
test: generate _sidebar.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records committed Jan 16, 2021
1 parent 70f026f commit a5656c0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions e2e/commands/generate.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const test = require('ava')
const fs = require('fs')
const path = require('path')

const {run} = require('../helpers/test-utils.js')

const genPath = path.join(__dirname, 'generate-cmd')
const docsPath = path.join(genPath, 'docs')

test.before('create temp directory', () => {
// Cleanup if the directory already exists
if (fs.existsSync(genPath)) {
fs.rmdirSync(genPath, {recursive: true})
}

fs.mkdirSync(genPath)
})

test.after('cleanup', () => {
fs.rmdirSync(genPath, {recursive: true})
})

test('generate _sidebar.md', t => {
run(['init', 'docs'], {cwd: genPath})
run(['generate', 'docs'], {cwd: genPath})
// Check for existence
t.true(fs.existsSync(path.join(docsPath, '_sidebar.md')))
})

0 comments on commit a5656c0

Please sign in to comment.