Skip to content
Merged
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
2 changes: 1 addition & 1 deletion functions/helloworld/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ exports.helloGCS = (event, callback) => {
exports.helloGCSGeneric = (event, callback) => {
const file = event.data;

console.log(` Event ${event.eventId}`);
console.log(` Event: ${event.eventId}`);
console.log(` Event Type: ${event.eventType}`);
console.log(` Bucket: ${file.bucket}`);
console.log(` File: ${file.name}`);
Expand Down
4 changes: 2 additions & 2 deletions functions/helloworld/test/sample.unit.http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const uuid = require(`uuid`);
const helloHttp = require(`..`).helloHttp;

test(`helloHttp: should print a name`, t => {
// Initialize mocks
// Mock ExpressJS 'req' and 'res' parameters
const name = uuid.v4();
const req = {
body: {
Expand All @@ -39,7 +39,7 @@ test(`helloHttp: should print a name`, t => {
});

test(`helloHttp: should print hello world`, t => {
// Initialize mocks
// Mock ExpressJS 'req' and 'res' parameters
const req = {
body: {}
};
Expand Down
4 changes: 2 additions & 2 deletions functions/log/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
'use strict';

// [START functions_log_helloworld]
exports.helloWorld = (event, callback) => {
exports.helloWorld = (req, res) => {
console.log('I am a log entry!');
console.error('I am an error!');
callback();
res.end();
};
// [END functions_log_helloworld]

Expand Down
8 changes: 4 additions & 4 deletions functions/log/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ test.afterEach.always(tools.restoreConsole);

test.serial(`should write to log`, (t) => {
const expectedMsg = `I am a log entry!`;
const callback = sinon.stub();
const res = { end: sinon.stub() };

getSample().program.helloWorld({}, callback);
getSample().program.helloWorld({}, res);

t.is(console.log.callCount, 1);
t.deepEqual(console.log.firstCall.args, [expectedMsg]);
t.is(callback.callCount, 1);
t.deepEqual(callback.firstCall.args, []);
t.is(res.end.callCount, 1);
t.deepEqual(res.end.firstCall.args, []);
});

test.serial(`getLogEntries: should retrieve logs`, (t) => {
Expand Down