File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
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
+ } )
You can’t perform that action at this time.
0 commit comments