@@ -114,73 +114,59 @@ describe("Custom inputs", () => {
114114 } ) ;
115115 } ) ;
116116
117- describe . each ( [
118- [
119- {
120- nextConfigDir : undefined ,
121- nextStaticDir : undefined ,
122- fixturePath : path . join ( __dirname , "./fixtures/simple-app" )
123- }
124- ] ,
125- [
126- {
127- nextConfigDir : "simple-app" ,
128- nextStaticDir : undefined ,
129- fixturePath : path . join ( __dirname , "./fixtures" )
130- }
131- ] ,
132- [
133- {
134- nextConfigDir : "nextConfigDir" ,
135- nextStaticDir : "nextStaticDir" ,
136- fixturePath : path . join ( __dirname , "./fixtures/split-app" )
137- }
138- ]
139- ] ) ( "Next config and static location" , ( { fixturePath, ...inputs } ) => {
140- beforeEach ( async ( ) => {
141- process . chdir ( fixturePath ) ;
142-
143- mockS3 . mockResolvedValue ( {
144- name : "bucket-xyz"
117+ describe . each `
118+ nextConfigDir | nextStaticDir | fixturePath
119+ ${ undefined } | ${ undefined } | ${ path . join ( __dirname , "./fixtures/simple-app" ) }
120+ ${ "simple-app" } | ${ undefined } | ${ path . join ( __dirname , "./fixtures" ) }
121+ ${ "nextConfigDir" } | ${ "nextStaticDir" } | ${ path . join ( __dirname , "./fixtures/split-app" ) }
122+ ` (
123+ "nextConfigDir=$nextConfigDir, nextStaticDir=$nextStaticDir" ,
124+ ( { fixturePath, ...inputs } ) => {
125+ beforeEach ( async ( ) => {
126+ process . chdir ( fixturePath ) ;
127+
128+ mockS3 . mockResolvedValue ( {
129+ name : "bucket-xyz"
130+ } ) ;
131+
132+ mockCloudFront . mockResolvedValueOnce ( {
133+ url : "https://cloudfrontdistrib.amazonaws.com"
134+ } ) ;
135+
136+ const component = createNextComponent ( ) ;
137+
138+ componentOutputs = await component . default ( {
139+ nextConfigDir : inputs . nextConfigDir ,
140+ nextStaticDir : inputs . nextStaticDir
141+ } ) ;
145142 } ) ;
146143
147- mockCloudFront . mockResolvedValueOnce ( {
148- url : "https://cloudfrontdistrib.amazonaws.com"
149- } ) ;
150-
151- const component = createNextComponent ( ) ;
152-
153- componentOutputs = await component . default ( {
154- nextConfigDir : inputs . nextConfigDir ,
155- nextStaticDir : inputs . nextStaticDir
144+ it ( "uploads static assets to S3 correctly" , ( ) => {
145+ expect ( mockUpload ) . toBeCalledWith (
146+ expect . objectContaining ( {
147+ Key : expect . stringMatching (
148+ "_next/static/test-build-id/placeholder.js"
149+ )
150+ } )
151+ ) ;
152+ expect ( mockUpload ) . toBeCalledWith (
153+ expect . objectContaining ( {
154+ Key : expect . stringMatching ( "static-pages/terms.html" )
155+ } )
156+ ) ;
157+ expect ( mockUpload ) . toBeCalledWith (
158+ expect . objectContaining ( {
159+ Key : expect . stringMatching ( "static/donotdelete.txt" )
160+ } )
161+ ) ;
162+ expect ( mockUpload ) . toBeCalledWith (
163+ expect . objectContaining ( {
164+ Key : expect . stringMatching ( "public/favicon.ico" )
165+ } )
166+ ) ;
156167 } ) ;
157- } ) ;
158-
159- it ( `sets nextConfigDir to "${ inputs . nextConfigDir } " and nextStaticDir to "${ inputs . nextStaticDir } "` , ( ) => {
160- expect ( mockUpload ) . toBeCalledWith (
161- expect . objectContaining ( {
162- Key : expect . stringMatching (
163- "_next/static/test-build-id/placeholder.js"
164- )
165- } )
166- ) ;
167- expect ( mockUpload ) . toBeCalledWith (
168- expect . objectContaining ( {
169- Key : expect . stringMatching ( "static-pages/terms.html" )
170- } )
171- ) ;
172- expect ( mockUpload ) . toBeCalledWith (
173- expect . objectContaining ( {
174- Key : expect . stringMatching ( "static/donotdelete.txt" )
175- } )
176- ) ;
177- expect ( mockUpload ) . toBeCalledWith (
178- expect . objectContaining ( {
179- Key : expect . stringMatching ( "public/favicon.ico" )
180- } )
181- ) ;
182- } ) ;
183- } ) ;
168+ }
169+ ) ;
184170
185171 describe . each ( [
186172 [ undefined , { defaultMemory : 512 , apiMemory : 512 } ] ,
0 commit comments