Skip to content

Commit

Permalink
test(reducers/user): adds basic test setup and user tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zcei committed Apr 9, 2016
1 parent 0e112af commit 8dbcf2b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
"description": ":one: :two: :three: :five: :eight: :one::three:",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "babel-tape-runner 'tests/**/*.test.js'",
"copy": "mkdirp dist && cp client/index.html dist && cp client/.htaccess dist && cp client/bookmarklet.js dist && cp -r client/assets dist",
"minify:html": "sed -i -- 's/esti.js/esti.min.js/' dist/index.html",
"minify:js": "uglifyjs --compress --mangle -- dist/esti.js > dist/esti.min.js",
Expand Down Expand Up @@ -57,14 57,18 @@
"babel-core": "^6.4.5",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-riot": "^1.0.2",
"babel-tape-runner": "^2.0.1",
"babelify": "6.1.x",
"browserify": "11.0.1",
"eslint": "^1.10.3",
"deep-freeze": "0.0.1",
"eslint": "^2.7.0",
"eslint-config-standard": "^4.4.0",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-standard": "^1.3.1",
"jade": "^1.11.0",
"mkdirp": "0.5.x",
"parallelshell": "^2.0.0"
"parallelshell": "^2.0.0",
"tape": "^4.5.1"
},
"browserify": {
"extensions": [
Expand Down
21 changes: 21 additions & 0 deletions tests/reducer/user.test.js
Original file line number Diff line number Diff line change
@@ -0,0 1,21 @@
import test from 'tape'
import deepFreeze from 'deep-freeze'

import userReducer from '../../client/reducers/user'
import * as actions from '../../actions/user'

test('User reducer "pm" property', (t) => {
const stateBefore = { pm: false }
const stateAfter = { pm: true }

deepFreeze(stateBefore)
deepFreeze(stateAfter)

t.deepEqual(
userReducer(stateBefore, actions.authenticated(true)),
stateAfter,
'should be pm after successful authentication'
)

t.end()
})

0 comments on commit 8dbcf2b

Please sign in to comment.