From 05b0e2214bf50576f410ab8105222585c4fce51c Mon Sep 17 00:00:00 2001 From: "pattishin@google.com" Date: Tue, 8 Aug 2023 13:41:26 -0700 Subject: [PATCH 1/3] refactor: shifting region tags to show imports tps could miss --- .../helloworld/helloworldHttp/test/sample.unit.http.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js b/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js index 6997f66a89..4ba5c86605 100644 --- a/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js +++ b/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js @@ -13,10 +13,10 @@ // limitations under the License. // FF testing layer for declarative signatures +// [START functions_http_unit_test] const {getFunction} = require('@google-cloud/functions-framework/testing'); describe('functions_helloworld_http', () => { - // [START functions_http_unit_test] const sinon = require('sinon'); const assert = require('assert'); require('../'); @@ -40,7 +40,7 @@ describe('functions_helloworld_http', () => { assert.strictEqual(mocks.res.send.calledOnceWith('Hello World!'), true); }); - // [END functions_http_unit_test] + it('helloHttp: should print a name with query', () => { const mocks = getMocks(); mocks.req.query = {name: 'John'}; @@ -61,3 +61,4 @@ describe('functions_helloworld_http', () => { assert.strictEqual(mocks.res.send.calledOnceWith('Hello John!'), true); }); }); +// [END functions_http_unit_test] From 3df772e627c053febefd496c0f79f6d942500974 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 8 Aug 2023 20:44:24 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../helloworld/helloworldHttp/test/sample.unit.http.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js b/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js index 4ba5c86605..48b117e632 100644 --- a/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js +++ b/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js @@ -40,7 +40,7 @@ describe('functions_helloworld_http', () => { assert.strictEqual(mocks.res.send.calledOnceWith('Hello World!'), true); }); - + it('helloHttp: should print a name with query', () => { const mocks = getMocks(); mocks.req.query = {name: 'John'}; From a7e67f267501a7fa2f547b684db93556f43d2bc0 Mon Sep 17 00:00:00 2001 From: "pattishin@google.com" Date: Wed, 9 Aug 2023 10:47:16 -0700 Subject: [PATCH 3/3] refactor: wrapping getFunction import under functions_http_unit_test region tag --- .../helloworld/helloworldHttp/test/sample.unit.http.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js b/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js index 48b117e632..f1ee48c365 100644 --- a/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js +++ b/functions/helloworld/helloworldHttp/test/sample.unit.http.test.js @@ -13,10 +13,13 @@ // limitations under the License. // FF testing layer for declarative signatures + // [START functions_http_unit_test] const {getFunction} = require('@google-cloud/functions-framework/testing'); +// [END functions_http_unit_test] describe('functions_helloworld_http', () => { + // [START functions_http_unit_test] const sinon = require('sinon'); const assert = require('assert'); require('../'); @@ -40,6 +43,7 @@ describe('functions_helloworld_http', () => { assert.strictEqual(mocks.res.send.calledOnceWith('Hello World!'), true); }); + // [END functions_http_unit_test] it('helloHttp: should print a name with query', () => { const mocks = getMocks(); @@ -61,4 +65,3 @@ describe('functions_helloworld_http', () => { assert.strictEqual(mocks.res.send.calledOnceWith('Hello John!'), true); }); }); -// [END functions_http_unit_test]