MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / getSample

Function getSample

functions/security/test/index.test.js:21–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19const assert = require('assert');
20
21const getSample = () => {
22 const fetchMock = sinon
23 .stub()
24 .onFirstCall()
25 .resolves({text: () => 'some-token'})
26 .onSecondCall()
27 .resolves({text: () => 'function-response'});
28
29 const resMock = {};
30 resMock.status = sinon.stub().returns(resMock);
31 resMock.send = sinon.stub().returns(resMock);
32
33 return {
34 sample: proxyquire('../', {
35 'node-fetch': fetchMock,
36 }),
37 mocks: {
38 res: resMock,
39 fetch: fetchMock,
40 },
41 };
42};
43
44describe('functions_bearer_token', () => {
45 it('should run', async () => {

Callers 1

index.test.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected