Commit a0777af7 authored by yogevbd's avatar yogevbd

Replace mocha with jest

parent bb5b455e
......@@ -2,7 +2,7 @@
"parser": "babel-eslint",
"env": {
"node": true,
"mocha": true,
"jest": true,
"es6": true
},
"extends": "eslint:recommended",
......
......@@ -178,3 +178,5 @@ jspm_packages
# Optional REPL history
.node_repl_history
coverage/
\ No newline at end of file
......@@ -2,7 +2,8 @@ module.exports = function (api) {
api && api.cache(false);
return {
presets: [
'module:metro-react-native-babel-preset'
'module:metro-react-native-babel-preset',
'@babel/preset-env'
],
plugins: [
'@babel/plugin-proposal-export-namespace-from',
......
......@@ -22,7 +22,7 @@
"main": "lib/src/index",
"scripts": {
"pretest": "./node_modules/.bin/eslint *.js test",
"test": "./node_modules/.bin/mocha --compilers js:babel-register --reporter spec \"test/*.spec.js\"",
"test": "jest",
"start": "node ./scripts/start",
"test-e2e-ios": "node ./scripts/test-e2e --ios"
},
......@@ -41,6 +41,7 @@
"@types/react-test-renderer": "16.x.x",
"@babel/plugin-proposal-export-default-from": "7.2.0",
"@babel/plugin-proposal-export-namespace-from": "7.2.0",
"@babel/preset-env": "7.5.0",
"typescript": "3.2.2",
"babel-eslint": "9.0.0",
"chai": "^3.5.0",
......@@ -55,7 +56,8 @@
"react": "16.8.6",
"detox": "12.x.x",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.55.x"
"metro-react-native-babel-preset": "0.55.x",
"@babel/register": "7.4.4"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
......@@ -101,10 +103,11 @@
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
},
"roots": [
"<rootDir>/node_modules/"
"<rootDir>/node_modules/",
"<rootDir>/test/"
],
"collectCoverageFrom": [
"lib/dist/**/*.js",
"lib/src/**/*.js",
"integration/**/*.js",
"!lib/dist/index.js",
"!lib/dist/Navigation.js",
......
This diff is collapsed.
This diff is collapsed.
'use strict';
import { expect } from 'chai';
import IOSNotification from '../notification.ios';
import IOSNotification from '../lib/src/notification.ios';
describe('iOS Notification Object', () => {
describe.only('iOS Notification Object', () => {
let notification;
let someBadgeCount = 123, someSound = 'someSound', someCategory = 'some_notification_category', someThread = 'thread-1';
......@@ -48,31 +46,31 @@ describe('iOS Notification Object', () => {
});
it('should return regular type', function () {
expect(notification.getType()).to.equal('regular');
expect(notification.getType()).toEqual('regular');
});
it('should return the alert object', () => {
expect(notification.getMessage()).to.deep.equal(nativeNotification.aps.alert);
expect(notification.getMessage()).toEqual(nativeNotification.aps.alert);
});
it('should return the sound', () => {
expect(notification.getSound()).to.equal(someSound);
expect(notification.getSound()).toEqual(someSound);
});
it('should return the badge count', () => {
expect(notification.getBadgeCount()).to.equal(someBadgeCount);
expect(notification.getBadgeCount()).toEqual(someBadgeCount);
});
it('should return the category', () => {
expect(notification.getCategory()).to.equal(someCategory);
expect(notification.getCategory()).toEqual(someCategory);
});
it('should return the thread', () => {
expect(notification.getThread()).to.equal('thread-1');
expect(notification.getThread()).toEqual('thread-1');
});
it('should return the custom data', () => {
expect(notification.getData()).to.deep.equal({ key1: 'value1', key2: 'value2' });
expect(notification.getData()).toEqual({ key1: 'value1', key2: 'value2' });
});
});
});
......@@ -102,27 +100,27 @@ describe('iOS Notification Object', () => {
});
it('should return managed type', function () {
expect(notification.getType()).to.equal('managed');
expect(notification.getType()).toEqual('managed');
});
it('should return the alert object', () => {
expect(notification.getMessage()).to.equal(managedNativeNotification.managedAps.alert);
expect(notification.getMessage()).toEqual(managedNativeNotification.managedAps.alert);
});
it('should return the sound', () => {
expect(notification.getSound()).to.equal(someSound);
expect(notification.getSound()).toEqual(someSound);
});
it('should return the badge count', () => {
expect(notification.getBadgeCount()).to.equal(someBadgeCount);
expect(notification.getBadgeCount()).toEqual(someBadgeCount);
});
it('should return the category', () => {
expect(notification.getCategory()).to.equal(someCategory);
expect(notification.getCategory()).toEqual(someCategory);
});
it('should return the custom data', () => {
expect(notification.getData()).to.deep.equal({ managedAps: managedNativeNotification.managedAps, key1: 'value1', key2: 'value2' });
expect(notification.getData()).toEqual({ 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