Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/stream-functions-api' into strea…
Browse files Browse the repository at this point in the history
…m-functions-api

# Conflicts:
#	firebase-functions/src/androidTest/java/com/google/firebase/functions/StramTests.kt
  • Loading branch information
MustafaJadid2025 committed Dec 26, 2024
2 parents 9e13ef7 + 535fb90 commit f0bd47a
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions firebase-functions/src/androidTest/backend/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const assert = require("assert");
const functions = require("firebase-functions");
const assert = require('assert');
const functions = require('firebase-functions');

exports.dataTest = functions.https.onRequest((request, response) => {
assert.deepEqual(request.body, {
data: {
"bool": true,
"int": 2,
"long": {
"value": "3",
"@type": "type.googleapis.com/google.protobuf.Int64Value",
bool: true,
int: 2,
long: {
value: '3',
'@type': 'type.googleapis.com/google.protobuf.Int64Value',
},
"string": "four",
"array": [5, 6],
"null": null,
},
string: 'four',
array: [5, 6],
'null': null,
}
});
response.send({
data: {
message: "stub response",
message: 'stub response',
code: 42,
long: {
"value": "420",
"@type": "type.googleapis.com/google.protobuf.Int64Value",
value: '420',
'@type': 'type.googleapis.com/google.protobuf.Int64Value',
},
},
}
});
});

Expand All @@ -47,29 +47,28 @@ exports.scalarTest = functions.https.onRequest((request, response) => {
});

exports.tokenTest = functions.https.onRequest((request, response) => {
assert.equal(request.get("Authorization"), "Bearer token");
assert.equal(request.get('Authorization'), 'Bearer token');
assert.deepEqual(request.body, {data: {}});
response.send({data: {}});
});

exports.instanceIdTest = functions.https.onRequest((request, response) => {
assert.equal(request.get("Firebase-Instance-ID-Token"), "iid");
assert.equal(request.get('Firebase-Instance-ID-Token'), 'iid');
assert.deepEqual(request.body, {data: {}});
response.send({data: {}});
});

exports.appCheckTest = functions.https.onRequest((request, response) => {
assert.equal(request.get("X-Firebase-AppCheck"), "appCheck");
assert.equal(request.get('X-Firebase-AppCheck'), 'appCheck');
assert.deepEqual(request.body, {data: {}});
response.send({data: {}});
});

exports.appCheckLimitedUseTest = functions.https.onRequest(
(request, response) => {
assert.equal(request.get("X-Firebase-AppCheck"), "appCheck-limited-use");
assert.deepEqual(request.body, {data: {}});
response.send({data: {}});
});
exports.appCheckLimitedUseTest = functions.https.onRequest((request, response) => {
assert.equal(request.get('X-Firebase-AppCheck'), 'appCheck-limited-use');
assert.deepEqual(request.body, {data: {}});
response.send({data: {}});
});

exports.nullTest = functions.https.onRequest((request, response) => {
assert.deepEqual(request.body, {data: null});
Expand All @@ -83,15 +82,15 @@ exports.missingResultTest = functions.https.onRequest((request, response) => {

exports.unhandledErrorTest = functions.https.onRequest((request, response) => {
// Fail in a way that the client shouldn't see.
throw new Error("nope");
throw 'nope';
});

exports.unknownErrorTest = functions.https.onRequest((request, response) => {
// Send an http error with a body with an explicit code.
response.status(400).send({
error: {
status: "THIS_IS_NOT_VALID",
message: "this should be ignored",
status: 'THIS_IS_NOT_VALID',
message: 'this should be ignored',
},
});
});
Expand All @@ -100,14 +99,14 @@ exports.explicitErrorTest = functions.https.onRequest((request, response) => {
// Send an http error with a body with an explicit code.
response.status(400).send({
error: {
status: "OUT_OF_RANGE",
message: "explicit nope",
status: 'OUT_OF_RANGE',
message: 'explicit nope',
details: {
start: 10,
end: 20,
long: {
"value": "30",
"@type": "type.googleapis.com/google.protobuf.Int64Value",
value: '30',
'@type': 'type.googleapis.com/google.protobuf.Int64Value',
},
},
},
Expand Down

0 comments on commit f0bd47a

Please # to comment.