Skip to content
Prev Previous commit
Next Next commit
remove junk and add some checks for rawpayload
  • Loading branch information
jimnor0xF committed Mar 12, 2024
commit d48204ae5b51bc7520df46de236b59be36fc6b0e
12 changes: 6 additions & 6 deletions spec/FCM.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ describe('FCM', () => {
'android',
);

// Up to the user to declare a payload compatible with the FCM v1 API
// so not checking anything else

expect(payload.data.data).toEqual(requestData.rawPayload.data);
expect(payload.data.notification).toEqual(
requestData.rawPayload.notification,
);
expect(payload.data.android).toEqual(requestData.rawPayload.android);
expect(payload.data.apns).toEqual(requestData.rawPayload.apns);
expect(payload.data.tokens).toEqual(['testToken']);
expect(payload.time).toEqual(timeStampISOStr);
expect(payload['push_id']).toEqual(pushId);
Expand Down Expand Up @@ -461,9 +464,6 @@ describe('FCM', () => {

const fcmPayload = payload.data;

// Not exactly the same as in APNS, think the APNS test case for this is wrong.
// According to https://docs.parseplatform.org/rest/guide/#sending-options
// This should be the alert message, and this is satisifed with a body key inside alert.
expect(fcmPayload.apns.payload.aps.alert).toEqual({ body: 'alert' });
expect(fcmPayload.apns.headers['apns-expiration']).toEqual(
Math.round(expirationTime / 1000),
Expand Down
4 changes: 0 additions & 4 deletions src/FCM.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ FCM.prototype.send = function (data, devices) {
function _APNSToFCMPayload(requestData) {
let coreData = requestData;

// Do not understand the intention of having a data object in the APNS payloads
// Users are also confused about this
// https://github.com/parse-community/parse-server/issues/6369#issuecomment-721095800
// but doing it like this to try and match how APNS does things currently even if it's strange.
if (requestData.hasOwnProperty('data')) {
coreData = requestData.data;
}
Expand Down