jest test suite - work start

This commit is contained in:
Elad Gil
2018-06-18 18:12:43 +03:00
parent 91f9aa329f
commit 0acf368307
4 changed files with 28 additions and 2 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"presets": ["react-native"]
}
+6
View File
@@ -0,0 +1,6 @@
import { NativeModules } from 'react-native';
NativeModules.RNBackgroundDownload = {
download: jest.fn(),
addListener: jest.fn()
};
+10
View File
@@ -0,0 +1,10 @@
import RNBackgroundDownload from '../index';
import DownloadTask from '../lib/downloadTask';
test('download should return a downloadTask', () => {
expect(RNBackgroundDownload.download({
id: 'test',
url: 'test',
destination: 'test'
})).toBeInstanceOf(DownloadTask);
});
+9 -2
View File
@@ -1,11 +1,10 @@
{
"name": "react-native-background-download",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest"
},
"keywords": [
"react-native"
@@ -14,5 +13,13 @@
"license": "",
"peerDependencies": {
"react-native": "^0.41.2"
},
"devDependencies": {
"jest": "^23.1.0",
"react-native": "^0.55.4"
},
"jest": {
"preset": "react-native",
"setupFiles": ["./__mocks__/RNBackgroundDownload.js"]
}
}