Commit a0777af7 authored by yogevbd's avatar yogevbd

Replace mocha with jest

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