@@ -20,6 +20,7 @@ const validConfigResponse = {
2020 } ,
2121 { include : [ '**/one/more/include/*' ] , exclude : [ ] } ,
2222 ] ,
23+ outputDir : '/output/dir' ,
2324}
2425
2526const sharedPropData = [
@@ -81,15 +82,15 @@ const propsData = {
8182}
8283
8384it ( 'should call getConfig with the passed config file location' , async ( ) => {
84- await buildPropsData ( '/root/' , '/astro/' , '/ config', false )
85+ await buildPropsData ( '/root/' , '/config' , false )
8586
8687 expect ( getConfig ) . toHaveBeenCalledWith ( '/config' )
8788} )
8889
8990it ( 'should not proceed if config is not found' , async ( ) => {
9091 ; ( getConfig as jest . Mock ) . mockResolvedValue ( undefined )
9192
92- await buildPropsData ( '/root/' , '/astro/' , '/ config', false )
93+ await buildPropsData ( '/root/' , '/config' , false )
9394
9495 expect ( writeFile ) . not . toHaveBeenCalled ( )
9596} )
@@ -100,7 +101,7 @@ it('should send an error to the console if the config file does not have a props
100101 const mockConsoleError = jest . fn ( )
101102 jest . spyOn ( console , 'error' ) . mockImplementation ( mockConsoleError )
102103
103- await buildPropsData ( '/root/' , '/astro/' , '/ config', false )
104+ await buildPropsData ( '/root/' , '/config' , false )
104105
105106 expect ( mockConsoleError ) . toHaveBeenCalledWith ( 'No props data found in config' )
106107 expect ( writeFile ) . not . toHaveBeenCalled ( )
@@ -111,7 +112,7 @@ it('should call glob with the propGlobs in the config file and the cwd set to th
111112 ; ( glob as unknown as jest . Mock ) . mockResolvedValue ( [ 'files/one' , 'files/two' ] )
112113 ; ( tsDocgen as jest . Mock ) . mockResolvedValue ( validTsDocGenResponseOne )
113114
114- await buildPropsData ( '/root/' , '/astro/' , '/ config', false )
115+ await buildPropsData ( '/root/' , '/config' , false )
115116
116117 expect ( glob ) . toHaveBeenNthCalledWith (
117118 1 ,
@@ -138,7 +139,7 @@ it('should call tsDocGen with each file that glob returns', async () => {
138139 ; ( tsDocgen as jest . Mock ) . mockReset ( )
139140 ; ( tsDocgen as jest . Mock ) . mockResolvedValue ( validTsDocGenResponseOne )
140141
141- await buildPropsData ( '/root/' , '/astro/' , '/ config', false )
142+ await buildPropsData ( '/root/' , '/config' , false )
142143
143144 expect ( tsDocgen ) . toHaveBeenNthCalledWith ( 1 , 'files/one' )
144145 expect ( tsDocgen ) . toHaveBeenNthCalledWith ( 2 , 'files/two' )
@@ -155,10 +156,10 @@ it('should call writeFile with the returned prop data in JSON form', async () =>
155156 ; ( tsDocgen as jest . Mock ) . mockResolvedValueOnce ( validTsDocGenResponseTwo )
156157 ; ( writeFile as jest . Mock ) . mockReset ( )
157158
158- await buildPropsData ( '/root/' , '/astro/' , '/ config', false )
159+ await buildPropsData ( '/root/' , '/config' , false )
159160
160161 expect ( writeFile ) . toHaveBeenCalledWith (
161- '/astro/dist /props.json' ,
162+ '/output/dir /props.json' ,
162163 JSON . stringify ( propsData ) ,
163164 )
164165} )
0 commit comments