Commit cbfbeb77 authored by yogevbd's avatar yogevbd

Fix lint

parent 942d62fa
import {NativeModules, DeviceEventEmitter} from "react-native"; import {NativeModules, DeviceEventEmitter} from 'react-native';
import NotificationAndroid from "./notification"; import NotificationAndroid from './notification';
const RNNotifications = NativeModules.WixRNNotifications; const RNNotifications = NativeModules.WixRNNotifications;
...@@ -10,7 +10,7 @@ let registrationTokenUpdateListener; ...@@ -10,7 +10,7 @@ let registrationTokenUpdateListener;
export class NotificationsAndroid { export class NotificationsAndroid {
static setNotificationOpenedListener(listener) { static setNotificationOpenedListener(listener) {
notificationOpenedListener = DeviceEventEmitter.addListener("notificationOpened", (notification) => listener(new NotificationAndroid(notification))); notificationOpenedListener = DeviceEventEmitter.addListener('notificationOpened', (notification) => listener(new NotificationAndroid(notification)));
} }
static clearNotificationOpenedListener() { static clearNotificationOpenedListener() {
...@@ -21,11 +21,11 @@ export class NotificationsAndroid { ...@@ -21,11 +21,11 @@ export class NotificationsAndroid {
} }
static setNotificationReceivedListener(listener) { static setNotificationReceivedListener(listener) {
notificationReceivedListener = DeviceEventEmitter.addListener("notificationReceived", (notification) => listener(new NotificationAndroid(notification))); notificationReceivedListener = DeviceEventEmitter.addListener('notificationReceived', (notification) => listener(new NotificationAndroid(notification)));
} }
static setNotificationReceivedInForegroundListener(listener) { static setNotificationReceivedInForegroundListener(listener) {
notificationReceivedInForegroundListener = DeviceEventEmitter.addListener("notificationReceivedInForeground", (notification) => listener(new NotificationAndroid(notification))); notificationReceivedInForegroundListener = DeviceEventEmitter.addListener('notificationReceivedInForeground', (notification) => listener(new NotificationAndroid(notification)));
} }
static clearNotificationReceivedListener() { static clearNotificationReceivedListener() {
...@@ -43,7 +43,7 @@ export class NotificationsAndroid { ...@@ -43,7 +43,7 @@ export class NotificationsAndroid {
} }
static setRegistrationTokenUpdateListener(listener) { static setRegistrationTokenUpdateListener(listener) {
registrationTokenUpdateListener = DeviceEventEmitter.addListener("remoteNotificationsRegistered", listener); registrationTokenUpdateListener = DeviceEventEmitter.addListener('remoteNotificationsRegistered', listener);
} }
static clearRegistrationTokenUpdateListener() { static clearRegistrationTokenUpdateListener() {
......
/** /**
* @flow * @flow
*/ */
"use strict"; 'use strict';
import { NativeModules, DeviceEventEmitter, NativeAppEventEmitter } from "react-native"; import { NativeModules, DeviceEventEmitter, NativeAppEventEmitter } from 'react-native';
import Map from "core-js/library/es6/map"; import Map from 'core-js/library/es6/map';
import uuid from "uuid"; import uuid from 'uuid';
const NativeRNNotifications = NativeModules.RNBridgeModule; // eslint-disable-line no-unused-vars const NativeRNNotifications = NativeModules.RNBridgeModule; // eslint-disable-line no-unused-vars
import IOSNotification from "./notification.ios"; import IOSNotification from './notification.ios';
export const DEVICE_REMOTE_NOTIFICATIONS_REGISTERED_EVENT = "remoteNotificationsRegistered"; export const DEVICE_REMOTE_NOTIFICATIONS_REGISTERED_EVENT = 'remoteNotificationsRegistered';
export const DEVICE_REMOTE_NOTIFICATIONS_REGISTRATION_FAILED_EVENT = "remoteNotificationsRegistrationFailed"; export const DEVICE_REMOTE_NOTIFICATIONS_REGISTRATION_FAILED_EVENT = 'remoteNotificationsRegistrationFailed';
export const DEVICE_PUSH_KIT_REGISTERED_EVENT = "pushKitRegistered"; export const DEVICE_PUSH_KIT_REGISTERED_EVENT = 'pushKitRegistered';
export const DEVICE_NOTIFICATION_RECEIVED_FOREGROUND_EVENT = "notificationReceivedForeground"; export const DEVICE_NOTIFICATION_RECEIVED_FOREGROUND_EVENT = 'notificationReceivedForeground';
export const DEVICE_NOTIFICATION_RECEIVED_BACKGROUND_EVENT = "notificationReceivedBackground"; export const DEVICE_NOTIFICATION_RECEIVED_BACKGROUND_EVENT = 'notificationReceivedBackground';
export const DEVICE_NOTIFICATION_OPENED_EVENT = "notificationOpened"; export const DEVICE_NOTIFICATION_OPENED_EVENT = 'notificationOpened';
const DEVICE_NOTIFICATION_ACTION_RECEIVED = "notificationActionReceived"; const DEVICE_NOTIFICATION_ACTION_RECEIVED = 'notificationActionReceived';
const _exportedEvents = [ const _exportedEvents = [
DEVICE_REMOTE_NOTIFICATIONS_REGISTERED_EVENT, DEVICE_REMOTE_NOTIFICATIONS_REGISTERED_EVENT,
...@@ -200,7 +200,7 @@ export default class NotificationsIOS { ...@@ -200,7 +200,7 @@ export default class NotificationsIOS {
* *
* - `alertBody` : The message displayed in the notification alert. * - `alertBody` : The message displayed in the notification alert.
* - `alertTitle` : The message title displayed in the notification. * - `alertTitle` : The message title displayed in the notification.
* - `alertAction` : The "action" displayed beneath an actionable notification. Defaults to "view"; * - `alertAction` : The 'action' displayed beneath an actionable notification. Defaults to 'view';
* - `soundName` : The sound played when the notification is fired (optional). * - `soundName` : The sound played when the notification is fired (optional).
* - `silent` : If true, the notification sound will be suppressed (optional). * - `silent` : If true, the notification sound will be suppressed (optional).
* - `category` : The category of this notification, required for actionable notifications (optional). * - `category` : The category of this notification, required for actionable notifications (optional).
......
...@@ -11,8 +11,8 @@ export default class IOSNotification { ...@@ -11,8 +11,8 @@ export default class IOSNotification {
this._data = {}; this._data = {};
if (notification.aps && if (notification.aps &&
notification.aps["content-available"] && notification.aps['content-available'] &&
notification.aps["content-available"] === 1 && notification.aps['content-available'] === 1 &&
!notification.aps.alert && !notification.aps.alert &&
!notification.aps.sound && !notification.aps.sound &&
notification.managedAps) { notification.managedAps) {
...@@ -21,8 +21,8 @@ export default class IOSNotification { ...@@ -21,8 +21,8 @@ export default class IOSNotification {
this._sound = notification.managedAps.sound; this._sound = notification.managedAps.sound;
this._badge = notification.aps.badge; this._badge = notification.aps.badge;
this._category = notification.managedAps.category; this._category = notification.managedAps.category;
this._type = "managed"; this._type = 'managed';
this._thread = notification.aps["thread-id"]; this._thread = notification.aps['thread-id'];
} else if ( } else if (
notification.aps && notification.aps &&
notification.aps.alert) { notification.aps.alert) {
...@@ -31,11 +31,11 @@ export default class IOSNotification { ...@@ -31,11 +31,11 @@ export default class IOSNotification {
this._sound = notification.aps.sound; this._sound = notification.aps.sound;
this._badge = notification.aps.badge; this._badge = notification.aps.badge;
this._category = notification.aps.category; this._category = notification.aps.category;
this._type = "regular"; this._type = 'regular';
this._thread = notification.aps["thread-id"]; this._thread = notification.aps['thread-id'];
} }
Object.keys(notification).filter(key => key !== "aps").forEach(key => { Object.keys(notification).filter(key => key !== 'aps').forEach(key => {
this._data[key] = notification[key]; this._data[key] = notification[key];
}); });
} }
......
...@@ -939,12 +939,6 @@ ...@@ -939,12 +939,6 @@
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
} }
}, },
"ajv-keywords": {
"version": "3.4.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ajv-keywords/-/ajv-keywords-3.4.0.tgz",
"integrity": "sha1-S4Mee1MUFafMUYzUBOc/YZPGNJ0=",
"dev": true
},
"ansi": { "ansi": {
"version": "0.3.1", "version": "0.3.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ansi/-/ansi-0.3.1.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ansi/-/ansi-0.3.1.tgz",
...@@ -1126,6 +1120,12 @@ ...@@ -1126,6 +1120,12 @@
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
"dev": true "dev": true
}, },
"astral-regex": {
"version": "1.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/astral-regex/-/astral-regex-1.0.0.tgz",
"integrity": "sha1-bIw/uCfdQ+45GPJ7gngqt2WKb9k=",
"dev": true
},
"async": { "async": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/async/-/async-2.6.2.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/async/-/async-2.6.2.tgz",
...@@ -2091,18 +2091,18 @@ ...@@ -2091,18 +2091,18 @@
} }
}, },
"caller-path": { "caller-path": {
"version": "0.1.0", "version": "2.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/caller-path/-/caller-path-0.1.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/caller-path/-/caller-path-2.0.0.tgz",
"integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=",
"dev": true, "dev": true,
"requires": { "requires": {
"callsites": "^0.2.0" "caller-callsite": "^2.0.0"
} }
}, },
"callsites": { "callsites": {
"version": "0.2.0", "version": "3.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/callsites/-/callsites-0.2.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", "integrity": "sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=",
"dev": true "dev": true
}, },
"camelcase": { "camelcase": {
...@@ -2143,9 +2143,9 @@ ...@@ -2143,9 +2143,9 @@
} }
}, },
"chardet": { "chardet": {
"version": "0.4.2", "version": "0.7.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/chardet/-/chardet-0.4.2.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/chardet/-/chardet-0.7.0.tgz",
"integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", "integrity": "sha1-kAlISfCTfy7twkJdDSip5fDLrZ4=",
"dev": true "dev": true
}, },
"chokidar": { "chokidar": {
...@@ -2180,12 +2180,6 @@ ...@@ -2180,12 +2180,6 @@
"yargs": "12.0.5" "yargs": "12.0.5"
} }
}, },
"circular-json": {
"version": "0.3.3",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/circular-json/-/circular-json-0.3.3.tgz",
"integrity": "sha1-gVyZ6oT2gJUp0vRXkb34JxE1LWY=",
"dev": true
},
"class-utils": { "class-utils": {
"version": "0.3.6", "version": "0.3.6",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/class-utils/-/class-utils-0.3.6.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/class-utils/-/class-utils-0.3.6.tgz",
...@@ -2431,6 +2425,24 @@ ...@@ -2431,6 +2425,24 @@
"is-directory": "^0.3.1", "is-directory": "^0.3.1",
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"parse-json": "^4.0.0" "parse-json": "^4.0.0"
},
"dependencies": {
"import-fresh": {
"version": "2.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/import-fresh/-/import-fresh-2.0.0.tgz",
"integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=",
"dev": true,
"requires": {
"caller-path": "^2.0.0",
"resolve-from": "^3.0.0"
}
},
"resolve-from": {
"version": "3.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/resolve-from/-/resolve-from-3.0.0.tgz",
"integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
"dev": true
}
} }
}, },
"create-react-class": { "create-react-class": {
...@@ -2614,9 +2626,9 @@ ...@@ -2614,9 +2626,9 @@
"dev": true "dev": true
}, },
"doctrine": { "doctrine": {
"version": "2.1.0", "version": "3.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/doctrine/-/doctrine-2.1.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/doctrine/-/doctrine-3.0.0.tgz",
"integrity": "sha1-XNAfwQFiG0LEzX9dGmYkNxbT850=", "integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=",
"dev": true, "dev": true,
"requires": { "requires": {
"esutils": "^2.0.2" "esutils": "^2.0.2"
...@@ -2634,6 +2646,12 @@ ...@@ -2634,6 +2646,12 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
"dev": true "dev": true
}, },
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha1-kzoEBShgyF6DwSJHnEdIqOTHIVY=",
"dev": true
},
"encodeurl": { "encodeurl": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/encodeurl/-/encodeurl-1.0.2.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/encodeurl/-/encodeurl-1.0.2.tgz",
...@@ -2721,49 +2739,46 @@ ...@@ -2721,49 +2739,46 @@
"dev": true "dev": true
}, },
"eslint": { "eslint": {
"version": "5.1.0", "version": "6.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/eslint/-/eslint-5.1.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/eslint/-/eslint-6.0.1.tgz",
"integrity": "sha1-LtYR8c4WPA+5nh4M2lr49mLf9kU=", "integrity": "sha1-SjIYHXLLmZ1vVBUd99M3Ex+Bzac=",
"dev": true, "dev": true,
"requires": { "requires": {
"ajv": "^6.5.0", "@babel/code-frame": "^7.0.0",
"babel-code-frame": "^6.26.0", "ajv": "^6.10.0",
"chalk": "^2.1.0", "chalk": "^2.1.0",
"cross-spawn": "^6.0.5", "cross-spawn": "^6.0.5",
"debug": "^3.1.0", "debug": "^4.0.1",
"doctrine": "^2.1.0", "doctrine": "^3.0.0",
"eslint-scope": "^4.0.0", "eslint-scope": "^4.0.3",
"eslint-utils": "^1.3.1", "eslint-utils": "^1.3.1",
"eslint-visitor-keys": "^1.0.0", "eslint-visitor-keys": "^1.0.0",
"espree": "^4.0.0", "espree": "^6.0.0",
"esquery": "^1.0.1", "esquery": "^1.0.1",
"esutils": "^2.0.2", "esutils": "^2.0.2",
"file-entry-cache": "^2.0.0", "file-entry-cache": "^5.0.1",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"glob": "^7.1.2", "glob-parent": "^3.1.0",
"globals": "^11.7.0", "globals": "^11.7.0",
"ignore": "^3.3.3", "ignore": "^4.0.6",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4", "imurmurhash": "^0.1.4",
"inquirer": "^5.2.0", "inquirer": "^6.2.2",
"is-resolvable": "^1.1.0", "is-glob": "^4.0.0",
"js-yaml": "^3.11.0", "js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1", "json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.3.0", "levn": "^0.3.0",
"lodash": "^4.17.5", "lodash": "^4.17.11",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"optionator": "^0.8.2", "optionator": "^0.8.2",
"path-is-inside": "^1.0.2",
"pluralize": "^7.0.0",
"progress": "^2.0.0", "progress": "^2.0.0",
"regexpp": "^1.1.0", "regexpp": "^2.0.1",
"require-uncached": "^1.0.3", "semver": "^5.5.1",
"semver": "^5.5.0",
"string.prototype.matchall": "^2.0.0",
"strip-ansi": "^4.0.0", "strip-ansi": "^4.0.0",
"strip-json-comments": "^2.0.1", "strip-json-comments": "^2.0.1",
"table": "^4.0.3", "table": "^5.2.3",
"text-table": "^0.2.0" "text-table": "^0.2.0"
}, },
"dependencies": { "dependencies": {
...@@ -2773,15 +2788,6 @@ ...@@ -2773,15 +2788,6 @@
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true "dev": true
}, },
"debug": {
"version": "3.2.6",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/debug/-/debug-3.2.6.tgz",
"integrity": "sha1-6D0X3hbYp++3cX7b5fsQE17uYps=",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"eslint-scope": { "eslint-scope": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/eslint-scope/-/eslint-scope-4.0.3.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/eslint-scope/-/eslint-scope-4.0.3.tgz",
...@@ -2826,12 +2832,12 @@ ...@@ -2826,12 +2832,12 @@
"dev": true "dev": true
}, },
"espree": { "espree": {
"version": "4.1.0", "version": "6.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/espree/-/espree-4.1.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/espree/-/espree-6.0.0.tgz",
"integrity": "sha1-co1UUeD9FWwEOEp62J7VH/VOsl8=", "integrity": "sha1-cW/B9aJF71uaf9sdew0/AjIudfY=",
"dev": true, "dev": true,
"requires": { "requires": {
"acorn": "^6.0.2", "acorn": "^6.0.7",
"acorn-jsx": "^5.0.0", "acorn-jsx": "^5.0.0",
"eslint-visitor-keys": "^1.0.0" "eslint-visitor-keys": "^1.0.0"
} }
...@@ -3037,13 +3043,13 @@ ...@@ -3037,13 +3043,13 @@
} }
}, },
"external-editor": { "external-editor": {
"version": "2.2.0", "version": "3.0.3",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/external-editor/-/external-editor-2.2.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/external-editor/-/external-editor-3.0.3.tgz",
"integrity": "sha1-BFURz9jRM/OEZnPRBHwVTiFK09U=", "integrity": "sha1-WGbbKal4Jtvkvzr9JAcOrZ6kOic=",
"dev": true, "dev": true,
"requires": { "requires": {
"chardet": "^0.4.0", "chardet": "^0.7.0",
"iconv-lite": "^0.4.17", "iconv-lite": "^0.4.24",
"tmp": "^0.0.33" "tmp": "^0.0.33"
} }
}, },
...@@ -3238,13 +3244,12 @@ ...@@ -3238,13 +3244,12 @@
} }
}, },
"file-entry-cache": { "file-entry-cache": {
"version": "2.0.0", "version": "5.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/file-entry-cache/-/file-entry-cache-2.0.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
"integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", "integrity": "sha1-yg9u+m3T1WEzP7FFFQZcL6/fQ5w=",
"dev": true, "dev": true,
"requires": { "requires": {
"flat-cache": "^1.2.1", "flat-cache": "^2.0.1"
"object-assign": "^4.0.1"
} }
}, },
"filename-regex": { "filename-regex": {
...@@ -3339,17 +3344,22 @@ ...@@ -3339,17 +3344,22 @@
} }
}, },
"flat-cache": { "flat-cache": {
"version": "1.3.4", "version": "2.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/flat-cache/-/flat-cache-1.3.4.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/flat-cache/-/flat-cache-2.0.1.tgz",
"integrity": "sha1-LC73dSXMKSkAff/6HdMUqpyd7m8=", "integrity": "sha1-XSltbwS9pEpGMKMBQTvbwuwIXsA=",
"dev": true, "dev": true,
"requires": { "requires": {
"circular-json": "^0.3.1", "flatted": "^2.0.0",
"graceful-fs": "^4.1.2", "rimraf": "2.6.3",
"rimraf": "~2.6.2", "write": "1.0.3"
"write": "^0.2.1"
} }
}, },
"flatted": {
"version": "2.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/flatted/-/flatted-2.0.1.tgz",
"integrity": "sha1-aeV8qo8OrLwoHS4stFjUb9tEngg=",
"dev": true
},
"for-in": { "for-in": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/for-in/-/for-in-1.0.2.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/for-in/-/for-in-1.0.2.tgz",
...@@ -4212,9 +4222,9 @@ ...@@ -4212,9 +4222,9 @@
} }
}, },
"ignore": { "ignore": {
"version": "3.3.10", "version": "4.0.6",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ignore/-/ignore-3.3.10.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ignore/-/ignore-4.0.6.tgz",
"integrity": "sha1-Cpf7h2mG6AgcYxFg+PnziRV/AEM=", "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=",
"dev": true "dev": true
}, },
"image-size": { "image-size": {
...@@ -4224,30 +4234,13 @@ ...@@ -4224,30 +4234,13 @@
"dev": true "dev": true
}, },
"import-fresh": { "import-fresh": {
"version": "2.0.0", "version": "3.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/import-fresh/-/import-fresh-2.0.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/import-fresh/-/import-fresh-3.1.0.tgz",
"integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", "integrity": "sha1-bTP6Hc7235MPrgA0RvM0Fa+QURg=",
"dev": true, "dev": true,
"requires": { "requires": {
"caller-path": "^2.0.0", "parent-module": "^1.0.0",
"resolve-from": "^3.0.0" "resolve-from": "^4.0.0"
},
"dependencies": {
"caller-path": {
"version": "2.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/caller-path/-/caller-path-2.0.0.tgz",
"integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=",
"dev": true,
"requires": {
"caller-callsite": "^2.0.0"
}
},
"resolve-from": {
"version": "3.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/resolve-from/-/resolve-from-3.0.0.tgz",
"integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
"dev": true
}
} }
}, },
"imurmurhash": { "imurmurhash": {
...@@ -4273,39 +4266,39 @@ ...@@ -4273,39 +4266,39 @@
"dev": true "dev": true
}, },
"inquirer": { "inquirer": {
"version": "5.2.0", "version": "6.4.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/inquirer/-/inquirer-5.2.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/inquirer/-/inquirer-6.4.1.tgz",
"integrity": "sha1-2zUMK3Paynf/EkOWLp8i8JloVyY=", "integrity": "sha1-e9nlqwVnzSO0GwGAto4M+oL8PAs=",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-escapes": "^3.0.0", "ansi-escapes": "^3.2.0",
"chalk": "^2.0.0", "chalk": "^2.4.2",
"cli-cursor": "^2.1.0", "cli-cursor": "^2.1.0",
"cli-width": "^2.0.0", "cli-width": "^2.0.0",
"external-editor": "^2.1.0", "external-editor": "^3.0.3",
"figures": "^2.0.0", "figures": "^2.0.0",
"lodash": "^4.3.0", "lodash": "^4.17.11",
"mute-stream": "0.0.7", "mute-stream": "0.0.7",
"run-async": "^2.2.0", "run-async": "^2.2.0",
"rxjs": "^5.5.2", "rxjs": "^6.4.0",
"string-width": "^2.1.0", "string-width": "^2.1.0",
"strip-ansi": "^4.0.0", "strip-ansi": "^5.1.0",
"through": "^2.3.6" "through": "^2.3.6"
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "4.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc=",
"dev": true "dev": true
}, },
"strip-ansi": { "strip-ansi": {
"version": "4.0.0", "version": "5.2.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/strip-ansi/-/strip-ansi-4.0.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-regex": "^3.0.0" "ansi-regex": "^4.1.0"
} }
} }
} }
...@@ -4548,12 +4541,6 @@ ...@@ -4548,12 +4541,6 @@
"has": "^1.0.1" "has": "^1.0.1"
} }
}, },
"is-resolvable": {
"version": "1.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/is-resolvable/-/is-resolvable-1.1.0.tgz",
"integrity": "sha1-+xj4fOH+uSUWnJpAfBkxijIG7Yg=",
"dev": true
},
"is-stream": { "is-stream": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/is-stream/-/is-stream-1.1.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/is-stream/-/is-stream-1.1.0.tgz",
...@@ -6112,6 +6099,15 @@ ...@@ -6112,6 +6099,15 @@
"integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=", "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=",
"dev": true "dev": true
}, },
"parent-module": {
"version": "1.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/parent-module/-/parent-module-1.0.1.tgz",
"integrity": "sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=",
"dev": true,
"requires": {
"callsites": "^3.0.0"
}
},
"parse-glob": { "parse-glob": {
"version": "3.0.4", "version": "3.0.4",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/parse-glob/-/parse-glob-3.0.4.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/parse-glob/-/parse-glob-3.0.4.tgz",
...@@ -6187,12 +6183,6 @@ ...@@ -6187,12 +6183,6 @@
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true "dev": true
}, },
"path-is-inside": {
"version": "1.0.2",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/path-is-inside/-/path-is-inside-1.0.2.tgz",
"integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
"dev": true
},
"path-key": { "path-key": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/path-key/-/path-key-2.0.1.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/path-key/-/path-key-2.0.1.tgz",
...@@ -6295,12 +6285,6 @@ ...@@ -6295,12 +6285,6 @@
} }
} }
}, },
"pluralize": {
"version": "7.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/pluralize/-/pluralize-7.0.0.tgz",
"integrity": "sha1-KYuJ34uTsCIdv0Ia0rGx6iP8Z3c=",
"dev": true
},
"posix-character-classes": { "posix-character-classes": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
...@@ -6577,6 +6561,12 @@ ...@@ -6577,6 +6561,12 @@
"supports-color": "^2.0.0" "supports-color": "^2.0.0"
} }
}, },
"chardet": {
"version": "0.4.2",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/chardet/-/chardet-0.4.2.tgz",
"integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=",
"dev": true
},
"cliui": { "cliui": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/cliui/-/cliui-3.2.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/cliui/-/cliui-3.2.0.tgz",
...@@ -6642,6 +6632,17 @@ ...@@ -6642,6 +6632,17 @@
"strip-eof": "^1.0.0" "strip-eof": "^1.0.0"
} }
}, },
"external-editor": {
"version": "2.2.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/external-editor/-/external-editor-2.2.0.tgz",
"integrity": "sha1-BFURz9jRM/OEZnPRBHwVTiFK09U=",
"dev": true,
"requires": {
"chardet": "^0.4.0",
"iconv-lite": "^0.4.17",
"tmp": "^0.0.33"
}
},
"get-stream": { "get-stream": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/get-stream/-/get-stream-3.0.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/get-stream/-/get-stream-3.0.0.tgz",
...@@ -6995,19 +6996,10 @@ ...@@ -6995,19 +6996,10 @@
"safe-regex": "^1.1.0" "safe-regex": "^1.1.0"
} }
}, },
"regexp.prototype.flags": {
"version": "1.2.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/regexp.prototype.flags/-/regexp.prototype.flags-1.2.0.tgz",
"integrity": "sha1-azByTjBqJ4M+6xcbZqyIkLo35Bw=",
"dev": true,
"requires": {
"define-properties": "^1.1.2"
}
},
"regexpp": { "regexpp": {
"version": "1.1.0", "version": "2.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/regexpp/-/regexpp-1.1.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/regexpp/-/regexpp-2.0.1.tgz",
"integrity": "sha1-DjUW3Qt5BPQT0tQZPc5GGMOmias=", "integrity": "sha1-jRnTHPYySCtYkEn4KB+T28uk0H8=",
"dev": true "dev": true
}, },
"regexpu-core": { "regexpu-core": {
...@@ -7086,16 +7078,6 @@ ...@@ -7086,16 +7078,6 @@
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true "dev": true
}, },
"require-uncached": {
"version": "1.0.3",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/require-uncached/-/require-uncached-1.0.3.tgz",
"integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",
"dev": true,
"requires": {
"caller-path": "^0.1.0",
"resolve-from": "^1.0.0"
}
},
"resolve": { "resolve": {
"version": "1.1.7", "version": "1.1.7",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/resolve/-/resolve-1.1.7.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/resolve/-/resolve-1.1.7.tgz",
...@@ -7103,9 +7085,9 @@ ...@@ -7103,9 +7085,9 @@
"dev": true "dev": true
}, },
"resolve-from": { "resolve-from": {
"version": "1.0.1", "version": "4.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/resolve-from/-/resolve-from-1.0.1.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", "integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=",
"dev": true "dev": true
}, },
"resolve-url": { "resolve-url": {
...@@ -7170,12 +7152,12 @@ ...@@ -7170,12 +7152,12 @@
} }
}, },
"rxjs": { "rxjs": {
"version": "5.5.12", "version": "6.5.2",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/rxjs/-/rxjs-5.5.12.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/rxjs/-/rxjs-6.5.2.tgz",
"integrity": "sha1-b6YbinfD15PbrycL7i9D9lLXQcw=", "integrity": "sha1-LjXOgVzUbYTQKiCftOWSHgUdvsc=",
"dev": true, "dev": true,
"requires": { "requires": {
"symbol-observable": "1.0.1" "tslib": "^1.9.0"
} }
}, },
"safe-buffer": { "safe-buffer": {
...@@ -7472,11 +7454,13 @@ ...@@ -7472,11 +7454,13 @@
"dev": true "dev": true
}, },
"slice-ansi": { "slice-ansi": {
"version": "1.0.0", "version": "2.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/slice-ansi/-/slice-ansi-1.0.0.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/slice-ansi/-/slice-ansi-2.1.0.tgz",
"integrity": "sha1-BE8aSdiEL/MHqta1Be0Xi9lQE00=", "integrity": "sha1-ys12k0YaY3pXiNkqfdT7oGjoFjY=",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-styles": "^3.2.0",
"astral-regex": "^1.0.0",
"is-fullwidth-code-point": "^2.0.0" "is-fullwidth-code-point": "^2.0.0"
} }
}, },
...@@ -7758,19 +7742,6 @@ ...@@ -7758,19 +7742,6 @@
} }
} }
}, },
"string.prototype.matchall": {
"version": "2.0.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/string.prototype.matchall/-/string.prototype.matchall-2.0.0.tgz",
"integrity": "sha1-Kvj+PS1txTyipZvTdrCJw8FSs8g=",
"dev": true,
"requires": {
"define-properties": "^1.1.2",
"es-abstract": "^1.10.0",
"function-bind": "^1.1.1",
"has-symbols": "^1.0.0",
"regexp.prototype.flags": "^1.2.0"
}
},
"string_decoder": { "string_decoder": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/string_decoder/-/string_decoder-1.1.1.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/string_decoder/-/string_decoder-1.1.1.tgz",
...@@ -7816,24 +7787,44 @@ ...@@ -7816,24 +7787,44 @@
"has-flag": "^3.0.0" "has-flag": "^3.0.0"
} }
}, },
"symbol-observable": {
"version": "1.0.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/symbol-observable/-/symbol-observable-1.0.1.tgz",
"integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=",
"dev": true
},
"table": { "table": {
"version": "4.0.3", "version": "5.4.1",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/table/-/table-4.0.3.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/table/-/table-5.4.1.tgz",
"integrity": "sha1-ALXitgLxeUuayvnKkIp2OGp4E7w=", "integrity": "sha1-BpGuLr6CWYWO+2PlULbV+TABceg=",
"dev": true, "dev": true,
"requires": { "requires": {
"ajv": "^6.0.1", "ajv": "^6.9.1",
"ajv-keywords": "^3.0.0", "lodash": "^4.17.11",
"chalk": "^2.1.0", "slice-ansi": "^2.1.0",
"lodash": "^4.17.4", "string-width": "^3.0.0"
"slice-ansi": "1.0.0", },
"string-width": "^2.1.1" "dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc=",
"dev": true
},
"string-width": {
"version": "3.1.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/string-width/-/string-width-3.1.0.tgz",
"integrity": "sha1-InZ74htirxCBV0MG9prFG2IgOWE=",
"dev": true,
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=",
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
}
}
} }
}, },
"temp": { "temp": {
...@@ -7969,6 +7960,12 @@ ...@@ -7969,6 +7960,12 @@
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
"dev": true "dev": true
}, },
"tslib": {
"version": "1.10.0",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/tslib/-/tslib-1.10.0.tgz",
"integrity": "sha1-w8GflZc/sKYpc/sJ2Q2WHuQ+XIo=",
"dev": true
},
"type-check": { "type-check": {
"version": "0.3.2", "version": "0.3.2",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/type-check/-/type-check-0.3.2.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/type-check/-/type-check-0.3.2.tgz",
...@@ -8292,9 +8289,9 @@ ...@@ -8292,9 +8289,9 @@
"dev": true "dev": true
}, },
"write": { "write": {
"version": "0.2.1", "version": "1.0.3",
"resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/write/-/write-0.2.1.tgz", "resolved": "https://repo.dev.wixpress.com/artifactory/api/npm/npm-repos/write/-/write-1.0.3.tgz",
"integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", "integrity": "sha1-CADhRSO5I6OH5BUSPIZWFqrg9cM=",
"dev": true, "dev": true,
"requires": { "requires": {
"mkdirp": "^0.5.1" "mkdirp": "^0.5.1"
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"babel-register": "^6.7.2", "babel-register": "^6.7.2",
"chai": "^3.5.0", "chai": "^3.5.0",
"chokidar-cli": "^1.2.0", "chokidar-cli": "^1.2.0",
"eslint": "5.1.x", "eslint": "6.0.1",
"mocha": "^2.5.3", "mocha": "^2.5.3",
"proxyquire": "^1.7.4", "proxyquire": "^1.7.4",
"sinon": "^1.17.3", "sinon": "^1.17.3",
......
"use strict"; 'use strict';
let expect = require("chai").use(require("sinon-chai")).expect; let expect = require('chai').use(require('sinon-chai')).expect;
import proxyquire from "proxyquire"; import proxyquire from 'proxyquire';
import sinon from "sinon"; import sinon from 'sinon';
describe("Notifications-Android > ", () => { describe('Notifications-Android > ', () => {
proxyquire.noCallThru(); proxyquire.noCallThru();
let refreshTokenStub; let refreshTokenStub;
...@@ -19,8 +19,8 @@ describe("Notifications-Android > ", () => { ...@@ -19,8 +19,8 @@ describe("Notifications-Android > ", () => {
cancelLocalNotificationStub = sinon.stub(); cancelLocalNotificationStub = sinon.stub();
deviceEventEmitterListenerStub = sinon.stub(); deviceEventEmitterListenerStub = sinon.stub();
libUnderTest = proxyquire("../index.android", { libUnderTest = proxyquire('../index.android', {
"react-native": { 'react-native': {
NativeModules: { NativeModules: {
WixRNNotifications: { WixRNNotifications: {
refreshToken: refreshTokenStub, refreshToken: refreshTokenStub,
...@@ -33,22 +33,22 @@ describe("Notifications-Android > ", () => { ...@@ -33,22 +33,22 @@ describe("Notifications-Android > ", () => {
addListener: deviceEventEmitterListenerStub addListener: deviceEventEmitterListenerStub
} }
}, },
"./notification": require("../notification.android") './notification': require('../notification.android')
}); });
}); });
describe("Registration token API", () => { describe('Registration token API', () => {
it("should assign callback to native event upon listener registration", () => { it('should assign callback to native event upon listener registration', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListener = () => {}; const userListener = () => {};
libUnderTest.NotificationsAndroid.setRegistrationTokenUpdateListener(userListener); libUnderTest.NotificationsAndroid.setRegistrationTokenUpdateListener(userListener);
expect(deviceEventEmitterListenerStub).to.have.been.calledWith("remoteNotificationsRegistered", userListener); expect(deviceEventEmitterListenerStub).to.have.been.calledWith('remoteNotificationsRegistered', userListener);
expect(deviceEventEmitterListenerStub).to.have.been.calledOnce; expect(deviceEventEmitterListenerStub).to.have.been.calledOnce;
}); });
it("should clear native event listener upon listener deregister", () => { it('should clear native event listener upon listener deregister', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListener = () => {}; const userListener = () => {};
const nativeListener = { const nativeListener = {
...@@ -62,28 +62,28 @@ describe("Notifications-Android > ", () => { ...@@ -62,28 +62,28 @@ describe("Notifications-Android > ", () => {
expect(nativeListener.remove).to.have.been.calledOnce; expect(nativeListener.remove).to.have.been.calledOnce;
}); });
it("shouldn't fail if deregister without registering", () => { it('shouldn`t fail if deregister without registering', () => {
libUnderTest.NotificationsAndroid.clearRegistrationTokenUpdateListener(); libUnderTest.NotificationsAndroid.clearRegistrationTokenUpdateListener();
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
}); });
}); });
describe("notification-opening API", () => { describe('notification-opening API', () => {
it("should assign callback to native event upon registration", () => { it('should assign callback to native event upon registration', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListenerStub = sinon.stub(); const userListenerStub = sinon.stub();
libUnderTest.NotificationsAndroid.setNotificationOpenedListener(userListenerStub); libUnderTest.NotificationsAndroid.setNotificationOpenedListener(userListenerStub);
expect(deviceEventEmitterListenerStub).to.have.been.calledOnce; expect(deviceEventEmitterListenerStub).to.have.been.calledOnce;
expect(deviceEventEmitterListenerStub).to.have.been.calledWith("notificationOpened", sinon.match.func); expect(deviceEventEmitterListenerStub).to.have.been.calledWith('notificationOpened', sinon.match.func);
}); });
it("should assign a wrapper-callback upon registration", () => { it('should assign a wrapper-callback upon registration', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListenerStub = sinon.stub(); const userListenerStub = sinon.stub();
const notification = { foo: "bar" }; const notification = { foo: 'bar' };
libUnderTest.NotificationsAndroid.setNotificationOpenedListener(userListenerStub); libUnderTest.NotificationsAndroid.setNotificationOpenedListener(userListenerStub);
...@@ -93,7 +93,7 @@ describe("Notifications-Android > ", () => { ...@@ -93,7 +93,7 @@ describe("Notifications-Android > ", () => {
expect(userListenerStub.args[0][0].getData()).to.equal(notification); expect(userListenerStub.args[0][0].getData()).to.equal(notification);
}); });
it("should clear native event listener upon listener deregister", () => { it('should clear native event listener upon listener deregister', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListener = () => {}; const userListener = () => {};
const nativeListener = { const nativeListener = {
...@@ -107,28 +107,28 @@ describe("Notifications-Android > ", () => { ...@@ -107,28 +107,28 @@ describe("Notifications-Android > ", () => {
expect(nativeListener.remove).to.have.been.calledOnce; expect(nativeListener.remove).to.have.been.calledOnce;
}); });
it("shouldn't fail if deregister without registering", () => { it('shouldnt fail if deregister without registering', () => {
libUnderTest.NotificationsAndroid.clearNotificationOpenedListener(); libUnderTest.NotificationsAndroid.clearNotificationOpenedListener();
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
}); });
}); });
describe("notification-receive API", () => { describe('notification-receive API', () => {
it("should assign callback to native event upon registration", () => { it('should assign callback to native event upon registration', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListenerStub = sinon.stub(); const userListenerStub = sinon.stub();
libUnderTest.NotificationsAndroid.setNotificationReceivedListener(userListenerStub); libUnderTest.NotificationsAndroid.setNotificationReceivedListener(userListenerStub);
expect(deviceEventEmitterListenerStub).to.have.been.calledOnce; expect(deviceEventEmitterListenerStub).to.have.been.calledOnce;
expect(deviceEventEmitterListenerStub).to.have.been.calledWith("notificationReceived", sinon.match.func); expect(deviceEventEmitterListenerStub).to.have.been.calledWith('notificationReceived', sinon.match.func);
}); });
it("should assign a wrapper-callback upon registration", () => { it('should assign a wrapper-callback upon registration', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListenerStub = sinon.stub(); const userListenerStub = sinon.stub();
const notification = { foo: "bar" }; const notification = { foo: 'bar' };
libUnderTest.NotificationsAndroid.setNotificationReceivedListener(userListenerStub); libUnderTest.NotificationsAndroid.setNotificationReceivedListener(userListenerStub);
...@@ -138,7 +138,7 @@ describe("Notifications-Android > ", () => { ...@@ -138,7 +138,7 @@ describe("Notifications-Android > ", () => {
expect(userListenerStub.args[0][0].getData()).to.equal(notification); expect(userListenerStub.args[0][0].getData()).to.equal(notification);
}); });
it("should clear native event listener upon listener deregister", () => { it('should clear native event listener upon listener deregister', () => {
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
const userListener = () => {}; const userListener = () => {};
const nativeListener = { const nativeListener = {
...@@ -152,25 +152,25 @@ describe("Notifications-Android > ", () => { ...@@ -152,25 +152,25 @@ describe("Notifications-Android > ", () => {
expect(nativeListener.remove).to.have.been.calledOnce; expect(nativeListener.remove).to.have.been.calledOnce;
}); });
it("shouldn't fail if deregister without registering", () => { it('shouldn`t fail if deregister without registering', () => {
libUnderTest.NotificationsAndroid.clearNotificationReceivedListener(); libUnderTest.NotificationsAndroid.clearNotificationReceivedListener();
expect(deviceEventEmitterListenerStub).to.not.have.been.called; expect(deviceEventEmitterListenerStub).to.not.have.been.called;
}); });
}); });
describe("Notification token", () => { describe('Notification token', () => {
it("should refresh notification token upon refreshing request by the user", () => { it('should refresh notification token upon refreshing request by the user', () => {
expect(refreshTokenStub).to.not.have.been.called; expect(refreshTokenStub).to.not.have.been.called;
libUnderTest.NotificationsAndroid.refreshToken(); libUnderTest.NotificationsAndroid.refreshToken();
expect(refreshTokenStub).to.have.been.calledOnce; expect(refreshTokenStub).to.have.been.calledOnce;
}); });
}); });
describe("Initial notification API", () => { describe('Initial notification API', () => {
it("should return initial notification data if available", (done) => { it('should return initial notification data if available', (done) => {
expect(getInitialNotificationStub).to.not.have.been.called; expect(getInitialNotificationStub).to.not.have.been.called;
const rawNotification = {foo: "bar"}; const rawNotification = {foo: 'bar'};
getInitialNotificationStub.returns(Promise.resolve(rawNotification)); getInitialNotificationStub.returns(Promise.resolve(rawNotification));
libUnderTest.PendingNotifications.getInitialNotification() libUnderTest.PendingNotifications.getInitialNotification()
...@@ -181,7 +181,7 @@ describe("Notifications-Android > ", () => { ...@@ -181,7 +181,7 @@ describe("Notifications-Android > ", () => {
.catch((err) => done(err)); .catch((err) => done(err));
}); });
it("should return empty notification if not available", (done) => { it('should return empty notification if not available', (done) => {
expect(getInitialNotificationStub).to.not.have.been.called; expect(getInitialNotificationStub).to.not.have.been.called;
getInitialNotificationStub.returns(Promise.resolve(null)); getInitialNotificationStub.returns(Promise.resolve(null));
...@@ -195,13 +195,13 @@ describe("Notifications-Android > ", () => { ...@@ -195,13 +195,13 @@ describe("Notifications-Android > ", () => {
}); });
describe("Local notification", () => { describe('Local notification', () => {
const notification = { const notification = {
title: "notification-title", title: 'notification-title',
body: "notification-body" body: 'notification-body'
}; };
it("should get published when posted manually", () => { it('should get published when posted manually', () => {
expect(postLocalNotificationStub).to.not.have.been.called; expect(postLocalNotificationStub).to.not.have.been.called;
const id = libUnderTest.NotificationsAndroid.localNotification(notification); const id = libUnderTest.NotificationsAndroid.localNotification(notification);
...@@ -209,7 +209,7 @@ describe("Notifications-Android > ", () => { ...@@ -209,7 +209,7 @@ describe("Notifications-Android > ", () => {
expect(postLocalNotificationStub).to.have.been.calledWith(notification, id); expect(postLocalNotificationStub).to.have.been.calledWith(notification, id);
}); });
it("should be called with a unique ID", () => { it('should be called with a unique ID', () => {
expect(postLocalNotificationStub).to.not.have.been.called; expect(postLocalNotificationStub).to.not.have.been.called;
const id = libUnderTest.NotificationsAndroid.localNotification(notification); const id = libUnderTest.NotificationsAndroid.localNotification(notification);
...@@ -219,7 +219,7 @@ describe("Notifications-Android > ", () => { ...@@ -219,7 +219,7 @@ describe("Notifications-Android > ", () => {
expect(id).to.not.equal(id2); expect(id).to.not.equal(id2);
}); });
it("should be cancellable with an ID", () => { it('should be cancellable with an ID', () => {
expect(cancelLocalNotificationStub).to.not.have.been.called; expect(cancelLocalNotificationStub).to.not.have.been.called;
libUnderTest.NotificationsAndroid.cancelLocalNotification(666); libUnderTest.NotificationsAndroid.cancelLocalNotification(666);
...@@ -227,5 +227,4 @@ describe("Notifications-Android > ", () => { ...@@ -227,5 +227,4 @@ describe("Notifications-Android > ", () => {
expect(cancelLocalNotificationStub).to.have.been.calledWith(666); expect(cancelLocalNotificationStub).to.have.been.calledWith(666);
}); });
}); });
}); });
"use strict"; 'use strict';
let expect = require("chai").use(require("sinon-chai")).expect; let expect = require('chai').use(require('sinon-chai')).expect;
import proxyquire from "proxyquire"; import proxyquire from 'proxyquire';
import sinon from "sinon"; import sinon from 'sinon';
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
describe("NotificationsIOS", () => { describe('NotificationsIOS', () => {
let deviceEvents = [ let deviceEvents = [
"pushKitRegistered", 'pushKitRegistered',
"remoteNotificationsRegistered", 'remoteNotificationsRegistered',
"remoteNotificationsRegistrationFailed", 'remoteNotificationsRegistrationFailed',
"notificationReceivedForeground", 'notificationReceivedForeground',
"notificationReceivedBackground", 'notificationReceivedBackground',
"notificationOpened" 'notificationOpened'
]; ];
/*eslint-disable indent*/ /*eslint-disable indent*/
...@@ -38,8 +38,8 @@ describe("NotificationsIOS", () => { ...@@ -38,8 +38,8 @@ describe("NotificationsIOS", () => {
let NotificationsIOS, NotificationAction, NotificationCategory; let NotificationsIOS, NotificationAction, NotificationCategory;
let someHandler = () => {}; let someHandler = () => {};
let constantGuid = "some-random-uuid"; let constantGuid = 'some-random-uuid';
let identifiers = ["some-random-uuid", "other-random-uuid"]; let identifiers = ['some-random-uuid', 'other-random-uuid'];
/*eslint-enable indent*/ /*eslint-enable indent*/
before(() => { before(() => {
...@@ -63,11 +63,11 @@ describe("NotificationsIOS", () => { ...@@ -63,11 +63,11 @@ describe("NotificationsIOS", () => {
nativeRemoveDeliveredNotifications = sinon.spy(); nativeRemoveDeliveredNotifications = sinon.spy();
nativeGetDeliveredNotifications = sinon.spy(); nativeGetDeliveredNotifications = sinon.spy();
let libUnderTest = proxyquire("../index.ios", { let libUnderTest = proxyquire('../index.ios', {
"uuid": { 'uuid': {
v4: () => constantGuid v4: () => constantGuid
}, },
"react-native": { 'react-native': {
NativeModules: { NativeModules: {
RNBridgeModule: { RNBridgeModule: {
requestPermissionsWithCategories: nativeRequestPermissionsWithCategories, requestPermissionsWithCategories: nativeRequestPermissionsWithCategories,
...@@ -101,7 +101,7 @@ describe("NotificationsIOS", () => { ...@@ -101,7 +101,7 @@ describe("NotificationsIOS", () => {
return { remove: deviceRemoveEventListener }; return { remove: deviceRemoveEventListener };
} }
}, },
"@noCallThru": true '@noCallThru': true
} }
}); });
...@@ -154,7 +154,7 @@ describe("NotificationsIOS", () => { ...@@ -154,7 +154,7 @@ describe("NotificationsIOS", () => {
NotificationCategory = null; NotificationCategory = null;
}); });
describe("Add Event Listener", () => { describe('Add Event Listener', () => {
deviceEvents.forEach(event => { deviceEvents.forEach(event => {
it(`should subscribe the given handler to device event: ${event}`, () => { it(`should subscribe the given handler to device event: ${event}`, () => {
NotificationsIOS.addEventListener(event, someHandler); NotificationsIOS.addEventListener(event, someHandler);
...@@ -163,14 +163,14 @@ describe("NotificationsIOS", () => { ...@@ -163,14 +163,14 @@ describe("NotificationsIOS", () => {
}); });
}); });
it("should not subscribe to unknown device events", () => { it('should not subscribe to unknown device events', () => {
NotificationsIOS.addEventListener("someUnsupportedEvent", someHandler); NotificationsIOS.addEventListener('someUnsupportedEvent', someHandler);
expect(deviceAddEventListener).to.not.have.been.called; expect(deviceAddEventListener).to.not.have.been.called;
}); });
}); });
describe("Remove Event Listener", () => { describe('Remove Event Listener', () => {
deviceEvents.forEach(event => { deviceEvents.forEach(event => {
it(`should unsubscribe the given handler from device event: ${event}`, () => { it(`should unsubscribe the given handler from device event: ${event}`, () => {
NotificationsIOS.addEventListener(event, someHandler); NotificationsIOS.addEventListener(event, someHandler);
...@@ -180,8 +180,8 @@ describe("NotificationsIOS", () => { ...@@ -180,8 +180,8 @@ describe("NotificationsIOS", () => {
}); });
}); });
it("should not unsubscribe to unknown device events", () => { it('should not unsubscribe to unknown device events', () => {
let someUnsupportedEvent = "someUnsupportedEvent"; let someUnsupportedEvent = 'someUnsupportedEvent';
NotificationsIOS.addEventListener(someUnsupportedEvent, someHandler); NotificationsIOS.addEventListener(someUnsupportedEvent, someHandler);
NotificationsIOS.removeEventListener(someUnsupportedEvent, someHandler); NotificationsIOS.removeEventListener(someUnsupportedEvent, someHandler);
...@@ -189,61 +189,61 @@ describe("NotificationsIOS", () => { ...@@ -189,61 +189,61 @@ describe("NotificationsIOS", () => {
}); });
}); });
describe("Notification actions handling", () => { describe('Notification actions handling', () => {
let someAction, someCategory; let someAction, someCategory;
let actionOpts = { let actionOpts = {
activationMode: "foreground", activationMode: 'foreground',
title: "someAction", title: 'someAction',
behavior: "default", behavior: 'default',
identifier: "SOME_ACTION" identifier: 'SOME_ACTION'
}; };
beforeEach(() => { beforeEach(() => {
someAction = new NotificationAction(actionOpts, () => {}); someAction = new NotificationAction(actionOpts, () => {});
someCategory = new NotificationCategory({ someCategory = new NotificationCategory({
identifier: "SOME_CATEGORY", identifier: 'SOME_CATEGORY',
actions: [someAction], actions: [someAction],
context: "default" context: 'default'
}); });
}); });
describe("register push notifications", () => { describe('register push notifications', () => {
it("should call native request permissions with array of categories", () => { it('should call native request permissions with array of categories', () => {
NotificationsIOS.requestPermissions([someCategory]); NotificationsIOS.requestPermissions([someCategory]);
expect(nativeRequestPermissionsWithCategories).to.have.been.calledWith([{ expect(nativeRequestPermissionsWithCategories).to.have.been.calledWith([{
identifier: "SOME_CATEGORY", identifier: 'SOME_CATEGORY',
actions: [actionOpts], actions: [actionOpts],
context: "default" context: 'default'
}]); }]);
}); });
it("should call native request permissions with empty array if no categories specified", () => { it('should call native request permissions with empty array if no categories specified', () => {
NotificationsIOS.requestPermissions(); NotificationsIOS.requestPermissions();
expect(nativeRequestPermissionsWithCategories).to.have.been.calledWith([]); expect(nativeRequestPermissionsWithCategories).to.have.been.calledWith([]);
}); });
it("should subscribe to 'notificationActionReceived' event once, with a single event handler", () => { it('should subscribe to notificationActionReceived event once, with a single event handler', () => {
NotificationsIOS.requestPermissions([someCategory]); NotificationsIOS.requestPermissions([someCategory]);
expect(nativeAppAddEventListener).to.have.been.calledOnce; expect(nativeAppAddEventListener).to.have.been.calledOnce;
expect(nativeAppAddEventListener).to.have.been.calledWith("notificationActionReceived", sinon.match.func); expect(nativeAppAddEventListener).to.have.been.calledWith('notificationActionReceived', sinon.match.func);
}); });
}); });
describe("reset categories", () => { describe('reset categories', () => {
it("should remove 'notificationActionReceived' event handler", () => { it('should remove notificationActionReceived event handler', () => {
NotificationsIOS.resetCategories(); NotificationsIOS.resetCategories();
expect(nativeAppRemoveEventListener).to.have.been.calledOnce; expect(nativeAppRemoveEventListener).to.have.been.calledOnce;
}); });
}); });
describe("get badges count", () => { describe('get badges count', () => {
it("should call native getBadgesCount", () => { it('should call native getBadgesCount', () => {
const callback = (count) => console.log(count); const callback = (count) => console.log(count);
NotificationsIOS.getBadgesCount(callback); NotificationsIOS.getBadgesCount(callback);
...@@ -251,8 +251,8 @@ describe("NotificationsIOS", () => { ...@@ -251,8 +251,8 @@ describe("NotificationsIOS", () => {
}); });
}); });
describe("set badges count", () => { describe('set badges count', () => {
it("should call native setBadgesCount", () => { it('should call native setBadgesCount', () => {
NotificationsIOS.setBadgesCount(44); NotificationsIOS.setBadgesCount(44);
expect(nativeSetBadgesCount).to.have.been.calledWith(44); expect(nativeSetBadgesCount).to.have.been.calledWith(44);
...@@ -261,24 +261,24 @@ describe("NotificationsIOS", () => { ...@@ -261,24 +261,24 @@ describe("NotificationsIOS", () => {
}); });
describe("register push kit for background notifications", function () { describe('register push kit for background notifications', function () {
it("should call native register push kit method", function () { it('should call native register push kit method', function () {
NotificationsIOS.registerPushKit(); NotificationsIOS.registerPushKit();
expect(nativeRegisterPushKit).to.have.been.called; expect(nativeRegisterPushKit).to.have.been.called;
}); });
}); });
describe("Abandon push notifications permissions", () => { describe('Abandon push notifications permissions', () => {
it("should call native abandon permissions method", () => { it('should call native abandon permissions method', () => {
NotificationsIOS.abandonPermissions(); NotificationsIOS.abandonPermissions();
expect(nativeAbandonPermissions).to.have.been.called; expect(nativeAbandonPermissions).to.have.been.called;
}); });
}); });
describe("Get background remaining time", () => { describe('Get background remaining time', () => {
it("should call native background remaining time method", () => { it('should call native background remaining time method', () => {
let someCallback = (time) => { }; let someCallback = (time) => { };
NotificationsIOS.backgroundTimeRemaining(someCallback); NotificationsIOS.backgroundTimeRemaining(someCallback);
...@@ -287,20 +287,20 @@ describe("NotificationsIOS", () => { ...@@ -287,20 +287,20 @@ describe("NotificationsIOS", () => {
}); });
}); });
describe("Dispatch local notification", () => { describe('Dispatch local notification', () => {
it("should return generated notification guid", () => { it('should return generated notification guid', () => {
expect(NotificationsIOS.localNotification({})).to.equal(constantGuid); expect(NotificationsIOS.localNotification({})).to.equal(constantGuid);
}); });
it("should call native local notification method with generated notification guid and notification object", () => { it('should call native local notification method with generated notification guid and notification object', () => {
let someLocalNotification = { let someLocalNotification = {
alertBody: "some body", alertBody: 'some body',
alertTitle: "some title", alertTitle: 'some title',
alertAction: "some action", alertAction: 'some action',
soundName: "sound", soundName: 'sound',
category: "SOME_CATEGORY", category: 'SOME_CATEGORY',
userInfo: { userInfo: {
"key": "value" 'key': 'value'
} }
}; };
...@@ -310,56 +310,56 @@ describe("NotificationsIOS", () => { ...@@ -310,56 +310,56 @@ describe("NotificationsIOS", () => {
}); });
}); });
describe("Cancel local notification", () => { describe('Cancel local notification', () => {
it("should call native cancel local notification method", () => { it('should call native cancel local notification method', () => {
NotificationsIOS.cancelLocalNotification(constantGuid); NotificationsIOS.cancelLocalNotification(constantGuid);
expect(nativeCancelLocalNotification).to.have.been.calledWith(constantGuid); expect(nativeCancelLocalNotification).to.have.been.calledWith(constantGuid);
}); });
}); });
describe("Cancel all local notifications", () => { describe('Cancel all local notifications', () => {
it("should call native cancel all local notifications method", () => { it('should call native cancel all local notifications method', () => {
NotificationsIOS.cancelAllLocalNotifications(); NotificationsIOS.cancelAllLocalNotifications();
expect(nativeCancelAllLocalNotifications).to.have.been.calledWith(); expect(nativeCancelAllLocalNotifications).to.have.been.calledWith();
}); });
}); });
describe("Is registered for remote notifications ", () => { describe('Is registered for remote notifications ', () => {
it("should call native is registered for remote notifications", () => { it('should call native is registered for remote notifications', () => {
NotificationsIOS.isRegisteredForRemoteNotifications(); NotificationsIOS.isRegisteredForRemoteNotifications();
expect(nativeIsRegisteredForRemoteNotifications).to.have.been.calledWith(); expect(nativeIsRegisteredForRemoteNotifications).to.have.been.calledWith();
}); });
}); });
describe("Check permissions ", () => { describe('Check permissions ', () => {
it("should call native check permissions", () => { it('should call native check permissions', () => {
NotificationsIOS.checkPermissions(); NotificationsIOS.checkPermissions();
expect(nativeCheckPermissions).to.have.been.calledWith(); expect(nativeCheckPermissions).to.have.been.calledWith();
}); });
}); });
describe("Remove all delivered notifications", () => { describe('Remove all delivered notifications', () => {
it("should call native remove all delivered notifications method", () => { it('should call native remove all delivered notifications method', () => {
NotificationsIOS.removeAllDeliveredNotifications(); NotificationsIOS.removeAllDeliveredNotifications();
expect(nativeRemoveAllDeliveredNotifications).to.have.been.calledWith(); expect(nativeRemoveAllDeliveredNotifications).to.have.been.calledWith();
}); });
}); });
describe("Remove delivered notifications", () => { describe('Remove delivered notifications', () => {
it("should call native remove delivered notifications method", () => { it('should call native remove delivered notifications method', () => {
NotificationsIOS.removeDeliveredNotifications(identifiers); NotificationsIOS.removeDeliveredNotifications(identifiers);
expect(nativeRemoveDeliveredNotifications).to.have.been.calledWith(identifiers); expect(nativeRemoveDeliveredNotifications).to.have.been.calledWith(identifiers);
}); });
}); });
describe("Get delivered notifications", () => { describe('Get delivered notifications', () => {
it("should call native get delivered notifications method", () => { it('should call native get delivered notifications method', () => {
const callback = (notifications) => console.log(notifications); const callback = (notifications) => console.log(notifications);
NotificationsIOS.getDeliveredNotifications(callback); NotificationsIOS.getDeliveredNotifications(callback);
......
"use strict"; 'use strict';
import { expect } from "chai"; import { expect } from 'chai';
import IOSNotification from "../notification.ios"; import IOSNotification from '../notification.ios';
describe("iOS Notification Object", () => { describe('iOS Notification Object', () => {
let notification; let notification;
let someBadgeCount = 123, someSound = "someSound", someCategory = "some_notification_category", someThread = "thread-1"; let someBadgeCount = 123, someSound = 'someSound', someCategory = 'some_notification_category', someThread = 'thread-1';
describe("for a regular iOS push notification", () => { describe('for a regular iOS push notification', () => {
let regularNativeNotifications = [ let regularNativeNotifications = [
// basic example, without content-available = 1 (aka silent notification) // basic example, without content-available = 1 (aka silent notification)
{ {
aps: { aps: {
alert: { alert: {
title: "some title", title: 'some title',
body: "some body" body: 'some body'
}, },
badge: someBadgeCount, badge: someBadgeCount,
sound: someSound, sound: someSound,
category: someCategory, category: someCategory,
"thread-id": someThread 'thread-id': someThread
}, },
key1: "value1", key1: 'value1',
key2: "value2" key2: 'value2'
}, },
// another example, with content-available but also with alert object (should not be a silent notification) // another example, with content-available but also with alert object (should not be a silent notification)
{ {
aps: { aps: {
"content-available": 1, 'content-available': 1,
alert: { alert: {
title: "some title", title: 'some title',
body: "some body" body: 'some body'
}, },
badge: someBadgeCount, badge: someBadgeCount,
sound: someSound, sound: someSound,
category: someCategory, category: someCategory,
"thread-id": someThread 'thread-id': someThread
}, },
key1: "value1", key1: 'value1',
key2: "value2" key2: 'value2'
} }
]; ];
...@@ -47,82 +47,82 @@ describe("iOS Notification Object", () => { ...@@ -47,82 +47,82 @@ describe("iOS Notification Object", () => {
notification = new IOSNotification(nativeNotification); notification = new IOSNotification(nativeNotification);
}); });
it("should return 'regular' type", function () { it('should return regular type', function () {
expect(notification.getType()).to.equal("regular"); expect(notification.getType()).to.equal('regular');
}); });
it("should return the alert object", () => { it('should return the alert object', () => {
expect(notification.getMessage()).to.deep.equal(nativeNotification.aps.alert); expect(notification.getMessage()).to.deep.equal(nativeNotification.aps.alert);
}); });
it("should return the sound", () => { it('should return the sound', () => {
expect(notification.getSound()).to.equal(someSound); expect(notification.getSound()).to.equal(someSound);
}); });
it("should return the badge count", () => { it('should return the badge count', () => {
expect(notification.getBadgeCount()).to.equal(someBadgeCount); expect(notification.getBadgeCount()).to.equal(someBadgeCount);
}); });
it("should return the category", () => { it('should return the category', () => {
expect(notification.getCategory()).to.equal(someCategory); expect(notification.getCategory()).to.equal(someCategory);
}); });
it("should return the thread", () => { it('should return the thread', () => {
expect(notification.getThread()).to.equal("thread-1"); expect(notification.getThread()).to.equal('thread-1');
}); });
it("should return the custom data", () => { it('should return the custom data', () => {
expect(notification.getData()).to.deep.equal({ key1: "value1", key2: "value2" }); expect(notification.getData()).to.deep.equal({ key1: 'value1', key2: 'value2' });
}); });
}); });
}); });
describe("for a managed iOS push notification (silent notification, with managedAps key and content-available = 1)", () => { describe('for a managed iOS push notification (silent notification, with managedAps key and content-available = 1)', () => {
let managedNativeNotification = { let managedNativeNotification = {
aps: { aps: {
"content-available": 1, 'content-available': 1,
badge: someBadgeCount badge: someBadgeCount
}, },
managedAps: { managedAps: {
action: "CREATE", action: 'CREATE',
notificationId: "1", notificationId: '1',
alert: { alert: {
title: "some title", title: 'some title',
body: "some body" body: 'some body'
}, },
sound: someSound, sound: someSound,
category: someCategory category: someCategory
}, },
key1: "value1", key1: 'value1',
key2: "value2" key2: 'value2'
}; };
beforeEach(() => { beforeEach(() => {
notification = new IOSNotification(managedNativeNotification); notification = new IOSNotification(managedNativeNotification);
}); });
it("should return 'managed' type", function () { it('should return managed type', function () {
expect(notification.getType()).to.equal("managed"); expect(notification.getType()).to.equal('managed');
}); });
it("should return the alert object", () => { it('should return the alert object', () => {
expect(notification.getMessage()).to.equal(managedNativeNotification.managedAps.alert); expect(notification.getMessage()).to.equal(managedNativeNotification.managedAps.alert);
}); });
it("should return the sound", () => { it('should return the sound', () => {
expect(notification.getSound()).to.equal(someSound); expect(notification.getSound()).to.equal(someSound);
}); });
it("should return the badge count", () => { it('should return the badge count', () => {
expect(notification.getBadgeCount()).to.equal(someBadgeCount); expect(notification.getBadgeCount()).to.equal(someBadgeCount);
}); });
it("should return the category", () => { it('should return the category', () => {
expect(notification.getCategory()).to.equal(someCategory); expect(notification.getCategory()).to.equal(someCategory);
}); });
it("should return the custom data", () => { it('should return the custom data', () => {
expect(notification.getData()).to.deep.equal({ managedAps: managedNativeNotification.managedAps, key1: "value1", key2: "value2" }); expect(notification.getData()).to.deep.equal({ managedAps: managedNativeNotification.managedAps, key1: 'value1', key2: 'value2' });
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment