1
1
import { promises as fs } from 'fs' ;
2
- import makeDir from 'make-dir' ;
3
2
import touch from 'touch' ;
4
3
import camelcase from 'camelcase' ;
5
4
import mustache from 'mustache' ;
@@ -25,7 +24,6 @@ describe('package build details', () => {
25
24
const projectRoot = any . string ( ) ;
26
25
const projectName = any . word ( ) ;
27
26
const pathToExample = `${ projectRoot } /example.js` ;
28
- const pathToCreatedSrcDirectory = any . string ( ) ;
29
27
const bundlerResults = any . simpleObject ( ) ;
30
28
const exampleContent = any . string ( ) ;
31
29
const pathToExampleTemplate = any . string ( ) ;
@@ -35,7 +33,6 @@ describe('package build details', () => {
35
33
const decisions = any . simpleObject ( ) ;
36
34
37
35
beforeEach ( ( ) => {
38
- when ( makeDir ) . calledWith ( `${ projectRoot } /src` ) . mockResolvedValue ( pathToCreatedSrcDirectory ) ;
39
36
when ( templatePath ) . calledWith ( 'example.mustache' ) . mockReturnValue ( pathToExampleTemplate ) ;
40
37
when ( fs . readFile ) . calledWith ( pathToExampleTemplate , 'utf8' ) . mockResolvedValue ( exampleTemplateContent ) ;
41
38
when ( camelcase ) . calledWith ( projectName ) . mockReturnValue ( camelizedProjectName ) ;
@@ -101,7 +98,8 @@ describe('package build details', () => {
101
98
buildDirectory : 'lib' ,
102
99
badges : { consumer : { } }
103
100
} ) ;
104
- expect ( touch ) . toHaveBeenCalledWith ( `${ pathToCreatedSrcDirectory } /index.js` ) ;
101
+ expect ( fs . mkdir ) . toHaveBeenCalledWith ( `${ projectRoot } /src` , { recursive : true } ) ;
102
+ expect ( touch ) . toHaveBeenCalledWith ( `${ projectRoot } /src/index.js` ) ;
105
103
expect ( fs . writeFile ) . toHaveBeenCalledWith ( pathToExample , exampleContent ) ;
106
104
} ) ;
107
105
0 commit comments