Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send deviceType key to push handler #39

Merged
merged 1 commit into from
Oct 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions spec/ParsePushAdapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ describe('ParsePushAdapter', () => {
];

var deviceMap = ParsePushAdapter.classifyInstallations(installations, validPushTypes);
expect(deviceMap['android']).toEqual([makeDevice('androidToken')]);
expect(deviceMap['ios']).toEqual([makeDevice('iosToken')]);
expect(deviceMap['android']).toEqual([makeDevice('androidToken', 'android')]);
expect(deviceMap['ios']).toEqual([makeDevice('iosToken', 'ios')]);
expect(deviceMap['win']).toBe(undefined);
done();
});
Expand Down Expand Up @@ -129,14 +129,14 @@ describe('ParsePushAdapter', () => {
var args = androidSender.send.calls.first().args;
expect(args[0]).toEqual(data);
expect(args[1]).toEqual([
makeDevice('androidToken')
makeDevice('androidToken', 'android')
]);
// Check ios sender
expect(iosSender.send).toHaveBeenCalled();
args = iosSender.send.calls.first().args;
expect(args[0]).toEqual(data);
expect(args[1]).toEqual([
makeDevice('iosToken')
makeDevice('iosToken', 'ios')
]);
done();
});
Expand Down Expand Up @@ -206,18 +206,18 @@ describe('ParsePushAdapter', () => {
var args = androidSender.send.calls.first().args;
expect(args[0]).toEqual(data);
expect(args[1]).toEqual([
makeDevice('androidToken'),
makeDevice('androidToken'),
makeDevice('androidToken'),
makeDevice('androidToken')
makeDevice('androidToken', 'android'),
makeDevice('androidToken', 'android'),
makeDevice('androidToken', 'android'),
makeDevice('androidToken', 'android')
]);
// Check ios sender
expect(iosSender.send).toHaveBeenCalled();
args = iosSender.send.calls.first().args;
expect(args[0]).toEqual(data);
expect(args[1]).toEqual([
makeDevice('iosToken'),
makeDevice('iosToken')
makeDevice('iosToken', 'ios'),
makeDevice('iosToken', 'ios')
]);
done();
});
Expand Down Expand Up @@ -281,9 +281,10 @@ describe('ParsePushAdapter', () => {
})
});

function makeDevice(deviceToken, appIdentifier) {
function makeDevice(deviceToken, deviceType, appIdentifier) {
return {
deviceToken: deviceToken,
deviceType: deviceType,
appIdentifier: appIdentifier
};
}
Expand Down
1 change: 1 addition & 0 deletions src/PushAdapterUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function classifyInstallations(installations, validPushTypes) {
if (Array.isArray(devices)) {
devices.push({
deviceToken: installation.deviceToken,
deviceType: installation.deviceType,
appIdentifier: installation.appIdentifier
});
}
Expand Down