Skip to content

Commit a06bd0d

Browse files
committed
Add test downloading Javy concurrently
1 parent 9fc6f93 commit a06bd0d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/app/src/cli/services/function/binaries.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff 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

146166
describe('javy-plugin', () => {

0 commit comments

Comments
 (0)