mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-04-29 20:35:37 +08:00
modify integration tests to work with Functions v0.4.0 SDK (#136)
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user