Skip to content

chore: update test #6534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ packages/*/lib/
!**/fixtures/**/functions_*/.netlify/edge-functions/manifest.json
!**/fixtures/**/monorepo/**/.netlify
**/plugins/deno-cli
!**/fixtures-esm/v2-api-files-and-directories/.netlify

lib
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default async () => new Response('Hello from extension')
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default async () => new Response('Hello from framework')
19 changes: 18 additions & 1 deletion packages/zip-it-and-ship-it/tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2945,6 +2945,9 @@ test('Supports both files and directories and ignores files that are not functio
const basePath = join(FIXTURES_ESM_DIR, 'v2-api-files-and-directories')
const files = await zipFunctions(
{
generated: {
directories: [join(basePath, '.netlify/functions-internal'), join(basePath, '.netlify/v1/functions')],
},
user: {
directories: [join(basePath, 'netlify/functions')],
functions: [
Expand All @@ -2961,7 +2964,7 @@ test('Supports both files and directories and ignores files that are not functio
},
)

expect(files.length).toBe(4)
expect(files.length).toBe(6)

const unzippedFunctions = await unzipFiles(files)
const functions = getFunctionResultsByName(unzippedFunctions)
Expand Down Expand Up @@ -2994,6 +2997,20 @@ test('Supports both files and directories and ignores files that are not functio
JSON.stringify({ func: 4, mod3: 'module-3', mod4: 'module-4' }),
)

const extension1 = await importFunctionFile(
`${tmpDir.path}/${functions.extension1.name}/${functions.extension1.entryFilename}`,
)
const extension1Result = await invokeLambda(extension1)
expect(extension1Result.statusCode).toBe(200)
expect(await readAsBuffer(extension1Result.body)).toStrictEqual('Hello from extension')

const framework1 = await importFunctionFile(
`${tmpDir.path}/${functions.framework1.name}/${functions.framework1.entryFilename}`,
)
const framework1Result = await invokeLambda(framework1)
expect(framework1Result.statusCode).toBe(200)
expect(await readAsBuffer(framework1Result.body)).toStrictEqual('Hello from framework')

await tmpDir.cleanup()
})

Expand Down
Loading