modify integration tests to work with Functions v0.4.0 SDK (#136)

This commit is contained in:
Lauren Long
2016-12-17 05:48:43 +08:00
committed by GitHub
parent 47a13bcacc
commit 0b4b8c73c1

View File

@@ -1,28 +1,31 @@
var functions = require('firebase-functions');
exports.dbAction = functions.database().path('/input/{uuid}').onWrite(function(event) {
console.log('Received event:', event);
return event.data.ref.root.child('output/' + event.params.uuid).set(event.data.val());
});
exports.nested = {
dbAction: functions.database().path('/inputNested/{uuid}').onWrite(function(event) {
console.log('Received event:', event);
return event.data.ref.root.child('output/' + event.params.uuid).set(event.data.val());
})
};
exports.httpsAction = functions.cloud.https().onRequest(function(req, res) {
exports.httpsAction = functions.https().onRequest(function(req, res) {
res.send(req.body);
});
exports.pubsubAction = functions.cloud.pubsub('topic1').onPublish(function(event) {
exports.pubsubAction = functions.pubsub('topic1').onPublish(function(event) {
console.log('Received event:', event);
var uuid = event.data.json;
var app = functions.app;
return app.database().ref('output/' + uuid).set(uuid);
});
exports.gcsAction = functions.cloud.storage('functions-integration-test.appspot.com')
.onChange(function(event) {
var uuid = event.data.data.name;
var app = functions.app;
return app.database().ref('output/' + uuid).set(uuid);
});
exports.gcsAction = functions.storage().onChange(function(event) {
console.log('Received event:', event);
var uuid = event.data.name;
var app = functions.app;
return app.database().ref('output/' + uuid).set(uuid);
});