Skip to content

Commit e1fbf45

Browse files
chore: add test to zip-it-and-ship-it (#6534)
1 parent 55857bb commit e1fbf45

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ packages/*/lib/
3131
!**/fixtures/**/functions_*/.netlify/edge-functions/manifest.json
3232
!**/fixtures/**/monorepo/**/.netlify
3333
**/plugins/deno-cli
34+
!**/fixtures-esm/v2-api-files-and-directories/.netlify
3435

3536
lib
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default async () => new Response('Hello from extension')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default async () => new Response('Hello from framework')

packages/zip-it-and-ship-it/tests/main.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2941,6 +2941,9 @@ test('Supports both files and directories and ignores files that are not functio
29412941
const basePath = join(FIXTURES_ESM_DIR, 'v2-api-files-and-directories')
29422942
const files = await zipFunctions(
29432943
{
2944+
generated: {
2945+
directories: [join(basePath, '.netlify/functions-internal'), join(basePath, '.netlify/v1/functions')],
2946+
},
29442947
user: {
29452948
directories: [join(basePath, 'netlify/functions')],
29462949
functions: [
@@ -2957,7 +2960,7 @@ test('Supports both files and directories and ignores files that are not functio
29572960
},
29582961
)
29592962

2960-
expect(files.length).toBe(4)
2963+
expect(files.length).toBe(6)
29612964

29622965
const unzippedFunctions = await unzipFiles(files)
29632966
const functions = getFunctionResultsByName(unzippedFunctions)
@@ -2990,6 +2993,20 @@ test('Supports both files and directories and ignores files that are not functio
29902993
JSON.stringify({ func: 4, mod3: 'module-3', mod4: 'module-4' }),
29912994
)
29922995

2996+
const extension1 = await importFunctionFile(
2997+
`${tmpDir.path}/${functions.extension1.name}/${functions.extension1.entryFilename}`,
2998+
)
2999+
const extension1Result = await invokeLambda(extension1)
3000+
expect(extension1Result.statusCode).toBe(200)
3001+
expect(await readAsBuffer(extension1Result.body)).toStrictEqual('Hello from extension')
3002+
3003+
const framework1 = await importFunctionFile(
3004+
`${tmpDir.path}/${functions.framework1.name}/${functions.framework1.entryFilename}`,
3005+
)
3006+
const framework1Result = await invokeLambda(framework1)
3007+
expect(framework1Result.statusCode).toBe(200)
3008+
expect(await readAsBuffer(framework1Result.body)).toStrictEqual('Hello from framework')
3009+
29933010
await tmpDir.cleanup()
29943011
})
29953012

0 commit comments

Comments
 (0)