Navigation Menu

Skip to content

Commit

Permalink
tests config'd and basic db test working
Browse files Browse the repository at this point in the history
  • Loading branch information
sandramchung committed Jul 17, 2017
1 parent 9a42cd3 commit 6a4150f
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,5 @@
npm-debug.log
.DS_Store
rethinkdb_data
.env
.env
__test__/test_data/*
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 1 addition & 0 deletions __mocks__/styleMock.js
@@ -0,0 +1 @@
module.exports = {};
1 change: 1 addition & 0 deletions __test__/backend.js
@@ -0,0 +1 @@
import { r } from '../src/server/models'
15 changes: 15 additions & 0 deletions __test__/backend.test.js
@@ -0,0 +1,15 @@
// first load the test db at the command line by running
// rethinkdb
// rethinkdb restore test_db.tar.gz

// delete the test database by running `r.dbDrop('test')` in the data explorer
// (http://localhost:8080)

import { r } from '../src/server/models'
// const backend = require('./backend');

test('test database exists', async () => {
const databaseList = await r.dbList();
return 'test' in databaseList;
});

Empty file.
4 changes: 4 additions & 0 deletions __test__/sum.js
@@ -0,0 +1,4 @@
function sum(a,b) {
return a+b;
}
module.exports = sum;
5 changes: 5 additions & 0 deletions __test__/sum.test.js
@@ -0,0 +1,5 @@
const sum = require('./sum');

test('adds 1+2 to equal 3', () => {
expect(sum(1,2)).toBe(3);
});
12 changes: 12 additions & 0 deletions package.json
Expand Up @@ -9,6 +9,7 @@
},
"scripts": {
"test": "npm run lint",
"jest": "jest",
"clean": "rm -rf $OUTPUT_DIR",
"lint": "eslint --fix --ext js --ext jsx src",
"prod-build-client": "webpack --config ./webpack/config.js",
Expand Down Expand Up @@ -118,16 +119,27 @@
},
"devDependencies": {
"babel-eslint": "^6.1.2",
"babel-jest": "^20.0.3",
"babel-register": "^6.9.0",
"eslint": "^2.9.0",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-import": "^1.10.2",
"eslint-plugin-jsx-a11y": "^1.5.5",
"eslint-plugin-react": "^5.2.2",
"foreman": "^1.4.1",
"jest": "^20.0.4",
"json2csv": "^3.6.2",
"nodemon": "^1.9.2",
"react-hot-loader": "^1.3.0",
"regenerator-runtime": "^0.10.5",
"webpack-dev-server": "^1.14.1"
},
"jest": {
"moduleFileExtensions": ["js", "jsx"],
"moduleDirectories": ["node_modules"],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
}
}

0 comments on commit 6a4150f

Please sign in to comment.