Skip to content

Commit

Permalink
fix: restored missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
karagulamos committed Jan 31, 2022
1 parent 1f2da26 commit b46b456
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/command.functions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,27 @@ test('should return the correct function url for a NetlifyFunction object', (t)
t.is(ntlFunction.url, functionUrl)
})

test('should return function response when invoked with no identity argument', async (t) => {
await withSiteBuilder('function-invoke-with-no-identity-argument', async (builder) => {
builder.withNetlifyToml({ config: { functions: { directory: 'functions' } } }).withFunction({
path: 'test-invoke.js',
handler: async () => ({
statusCode: 200,
body: 'success',
}),
})

await builder.buildAsync()

await withDevServer({ cwd: builder.directory }, async (server) => {
const stdout = await callCli(['functions:invoke', 'test-invoke', `--port=${server.port}`], {
cwd: builder.directory,
})
t.is(stdout, 'success')
})
})
})

test('should return function response when invoked', async (t) => {
await withSiteBuilder('site-with-ping-function', async (builder) => {
builder.withNetlifyToml({ config: { functions: { directory: 'functions' } } }).withFunction({
Expand Down

0 comments on commit b46b456

Please sign in to comment.