Skip to content

Commit e19028a

Browse files
funkenstrahlendplewis
authored andcommitted
add test case for apns priority (#134)
should be set to 10 if not defined explicitly. The priority of the notification. If you omit this header, APNs sets the notification priority to 10. Specify 10 to send the notification immediately. A value of 10 is appropriate for notifications that trigger an alert, play a sound, or badge the app’s icon. It's an error to specify this priority for a notification whose payload contains the content-available key. Specify 5 to send the notification based on power considerations on the user’s device. Use this priority for notifications whose payload includes the content-available key. Notifications with this priority might be grouped and delivered in bursts to the user’s device. They may also be throttled, and in some cases not delivered.
1 parent 954b867 commit e19028a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/APNS.spec.js

+18
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,24 @@ describe('APNS', () => {
156156
done();
157157
});
158158

159+
it('sets priority to 10 if not set explicitly', (done) => {
160+
let data = {
161+
'alert': 'alert',
162+
'title': 'title',
163+
'badge': 100,
164+
'sound': 'test',
165+
'content-available': 1,
166+
'mutable-content': 1,
167+
'category': 'INVITE_CATEGORY',
168+
'threadId': 'a-thread-id',
169+
'key': 'value',
170+
'keyAgain': 'valueAgain'
171+
};
172+
let notification = APNS._generateNotification(data, { });
173+
expect(notification.priority).toEqual(10);
174+
done();
175+
});
176+
159177
it('can generate APNS notification', (done) => {
160178
//Mock request data
161179
let data = {

0 commit comments

Comments
 (0)