From b46b456094124a6fb62cc4209d529eb34865042f Mon Sep 17 00:00:00 2001 From: Alexander Karagulamos Date: Mon, 31 Jan 2022 11:21:22 +0100 Subject: [PATCH] fix: restored missing test --- tests/command.functions.test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/command.functions.test.js b/tests/command.functions.test.js index 5bc6f6cd44c..cc892d0519a 100644 --- a/tests/command.functions.test.js +++ b/tests/command.functions.test.js @@ -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({