Skip to content

Commit

Permalink
Merge 8aa973a into 08e925e
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed Jul 12, 2018
2 parents 08e925e + 8aa973a commit 4b7dedd
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 77 deletions.
2 changes: 2 additions & 0 deletions config.json.example
Expand Up @@ -78,6 +78,8 @@
"PUSH_CONFIGS": {
"GCM_SERVER_API_KEY": "",
"APN_ENABLED": "false",
"APN_KEY_ID": "xxxxxxxxxx",
"APN_TEAM_ID": "aaabbbcccd",
"FCM_SERVER_API_KEY": ""
},
"SITE_HTTP_AUTH": {
Expand Down
153 changes: 113 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -11,6 +11,7 @@
"apidoc": "^0.17.5",
"autoprefixer": "^8.5.0",
"aws-sdk": "^2.239.1",
"apn": "^2.2.0",
"axios": "^0.18.0",
"axios-progress-bar": "^1.2.0",
"babel-core": "^6.26.3",
Expand Down Expand Up @@ -78,7 +79,6 @@
"postcss-easy-import": "^3.0.0",
"ps-tree": "^1.0.0",
"pug": "^2.0.3",
"push-notify": "git://github.com/habitrpg/push-notify.git#6bc2b5fdb1bdc9649b9ec1964d79ca50187fc8a9",
"pusher": "^1.3.0",
"rimraf": "^2.4.3",
"sass-loader": "^7.0.0",
Expand Down
13 changes: 7 additions & 6 deletions test/api/unit/libs/pushNotifications.js
@@ -1,6 +1,6 @@
import { model as User } from '../../../../website/server/models/user';
import requireAgain from 'require-again';
import pushNotify from 'push-notify';
import apn from 'apn/mock';
import nconf from 'nconf';
import gcmLib from 'node-gcm'; // works with FCM notifications too

Expand All @@ -24,7 +24,7 @@ describe('pushNotifications', () => {

sandbox.stub(gcmLib.Sender.prototype, 'send').callsFake(fcmSendSpy);

sandbox.stub(pushNotify, 'apn').returns({
sandbox.stub(apn.Provider.prototype, 'send').returns({
on: () => null,
send: apnSendSpy,
});
Expand Down Expand Up @@ -104,10 +104,7 @@ describe('pushNotifications', () => {
},
};

sendPushNotification(user, details);
expect(apnSendSpy).to.have.been.calledOnce;
expect(apnSendSpy).to.have.been.calledWithMatch({
token: '123',
const expectedNotification = new apn.Notification({
alert: message,
sound: 'default',
category: 'fun',
Expand All @@ -117,6 +114,10 @@ describe('pushNotifications', () => {
b: true,
},
});

sendPushNotification(user, details);
expect(apnSendSpy).to.have.been.calledOnce;
expect(apnSendSpy).to.have.been.calledWithMatch(expectedNotification, '123');
expect(fcmSendSpy).to.not.have.been.called;
});
});
2 changes: 1 addition & 1 deletion website/common/script/ops/buy/buy.js
Expand Up @@ -15,7 +15,7 @@ import {BuyGemOperation} from './buyGem';
import {BuyQuestWithGemOperation} from './buyQuestGem';

// @TODO: remove the req option style. Dependency on express structure is an anti-pattern
// We should either have more parms or a set structure validated by a Type checker
// We should either have more params or a set structure validated by a Type checker

// @TODO: when we are sure buy is the only function used, let's move the buy files to a folder

Expand Down

0 comments on commit 4b7dedd

Please sign in to comment.