File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
packages/app/src/cli/services/function Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,26 @@ describe('javy', () => {
141141 expect ( fetch ) . toHaveBeenCalledOnce ( )
142142 await expect ( fileExists ( javy . path ) ) . resolves . toBeTruthy ( )
143143 } )
144+
145+ test ( 'handles concurrent downloads of Javy' , async ( ) => {
146+ // Given
147+ await removeFile ( javy . path )
148+ await expect ( fileExists ( javy . path ) ) . resolves . toBeFalsy ( )
149+ vi . mocked ( fetch ) . mockResolvedValue ( new Response ( gzipSync ( 'javy binary' ) ) )
150+
151+ // When
152+ await Promise . all ( [
153+ downloadBinary ( javy ) ,
154+ downloadBinary ( javy ) ,
155+ downloadBinary ( javy ) ,
156+ downloadBinary ( javy ) ,
157+ downloadBinary ( javy ) ,
158+ ] )
159+
160+ // Then
161+ expect ( fetch ) . toHaveBeenCalledOnce ( )
162+ await expect ( fileExists ( javy . path ) ) . resolves . toBeTruthy ( )
163+ } )
144164} )
145165
146166describe ( 'javy-plugin' , ( ) => {
You can’t perform that action at this time.
0 commit comments