Skip to content

Commit

Permalink
test: fix and improve fcm push transport send specs
Browse files Browse the repository at this point in the history
  • Loading branch information
lykmapipo committed May 28, 2019
1 parent 784f46b commit dcefc1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/transports/push.fcm.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ exports._send = function (message, done) {
_.merge({}, message.options, {
notification: {
title: message.subject,
body: message.body
body: message.body,
sound: 'default'
}
});

Expand Down Expand Up @@ -193,7 +194,7 @@ exports._send = function (message, done) {
//respond with success result
else {
//merge default response details
response = _.merge({}, { success: true }, response);
response.success = response.success === 1 ? true : false;

//process push results if available
if (response.results) {
Expand Down
10 changes: 7 additions & 3 deletions test/integration/message.send.fcm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const path = require('path');
const { expect } = require('chai');
const { clear } = require('@lykmapipo/mongoose-test-helpers');
const { Message } = require(path.join(__dirname, '..', '..'));
const { Message, Push } = require(path.join(__dirname, '..', '..'));


describe('fcm transport', () => {
Expand Down Expand Up @@ -58,9 +58,13 @@ describe('fcm transport', () => {

it('should be able to send message', (done) => {

const message = new Message({
const message = new Push({
to: process.env.PUSH_FCM_TEST_REGISTRATION_TOKEN,
body: 'Test Push'
subject: 'Test',
body: 'Receive Push Notification',
options: {
data: { level: 1 }
}
});
message.transport = 'fcm-push';

Expand Down

0 comments on commit dcefc1e

Please sign in to comment.