diff --git a/circle.yml b/circle.yml index 1e693cce6..d4303887f 100644 --- a/circle.yml +++ b/circle.yml @@ -18,4 +18,4 @@ dependencies: test: override: - - yarn test + - yarn test -- --runInBand diff --git a/modules/web/__tests__/.eslintrc.yml b/modules/web/__tests__/.eslintrc.yml new file mode 100644 index 000000000..5c7dd5029 --- /dev/null +++ b/modules/web/__tests__/.eslintrc.yml @@ -0,0 +1 @@ +extends: ../../../.eslintrc-test.yml diff --git a/modules/web/__tests__/app-container.test.js b/modules/web/__tests__/app-container.test.js new file mode 100644 index 000000000..17b392861 --- /dev/null +++ b/modules/web/__tests__/app-container.test.js @@ -0,0 +1,36 @@ +// @flow + +import React from 'react' +import { mount } from 'enzyme' + +import configureStore from '../redux' +import ReduxWrapper from '../redux-wrapper' +import Router from 'react-router/lib/Router' +import { createMemoryHistory } from 'history' +import routes from '../routes' + +import debug from 'debug' +debug.enable('foo') + +test('AppContainer renders', () => { + mount( + + + + ) +}) + +test('AppContainer can navigate to /create', () => { + const store = configureStore() + const history = createMemoryHistory() + + const app = mount( + + + + ) + + history.push('/create') + + expect(app.find('h1').text()).toEqual('Hi there!') +}) diff --git a/package.json b/package.json index acaef48fb..7d3afef57 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "setupFiles": [ "./config/mocha-harness.js" ], + "setupTestFrameworkScriptFile": "./node_modules/jest-enzyme/lib/index.js", "collectCoverageFrom": [ "modules/**/*.js" ], @@ -155,6 +156,7 @@ "glob": "7.1.1", "graceful-fs": "4.1.11", "jest": "19.0.2", + "jest-enzyme": "2.1.2", "js-beautify": "1.6.11", "json-loader": "0.5.4", "junk": "2.1.0", diff --git a/yarn.lock b/yarn.lock index 7cefa7462..694f04c64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1752,6 +1752,12 @@ deep-eql@^0.1.3: dependencies: type-detect "0.1.1" +deep-equal-ident@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/deep-equal-ident/-/deep-equal-ident-1.1.1.tgz#06f4b89e53710cd6cea4a7781c7a956642de8dc9" + dependencies: + lodash.isequal "^3.0" + deep-extend@~0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.1.tgz#efe4113d08085f4e6f9687759810f807469e2253" @@ -1964,6 +1970,12 @@ entities@^1.1.1, entities@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" +enzyme-matchers@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/enzyme-matchers/-/enzyme-matchers-2.1.2.tgz#da2c20c3d55b128db3de6a5016f2531066b8061f" + dependencies: + deep-equal-ident "^1.1.1" + enzyme@2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-2.7.1.tgz#76370e1d99e91f73091bb8c4314b7c128cc2d621" @@ -3396,6 +3408,12 @@ jest-environment-node@^19.0.2: jest-mock "^19.0.0" jest-util "^19.0.2" +jest-enzyme@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/jest-enzyme/-/jest-enzyme-2.1.2.tgz#707187aabef9fbb7d018c1a2853ee9d8674ba629" + dependencies: + enzyme-matchers "^2.1.2" + jest-file-exists@^19.0.0: version "19.0.0" resolved "https://registry.yarnpkg.com/jest-file-exists/-/jest-file-exists-19.0.0.tgz#cca2e587a11ec92e24cfeab3f8a94d657f3fceb8" @@ -3751,6 +3769,18 @@ lodash._basefor@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/lodash._basefor/-/lodash._basefor-3.0.3.tgz#7550b4e9218ef09fad24343b612021c79b4c20c2" +lodash._baseisequal@^3.0.0: + version "3.0.7" + resolved "https://registry.yarnpkg.com/lodash._baseisequal/-/lodash._baseisequal-3.0.7.tgz#d8025f76339d29342767dcc887ce5cb95a5b51f1" + dependencies: + lodash.isarray "^3.0.0" + lodash.istypedarray "^3.0.0" + lodash.keys "^3.0.0" + +lodash._bindcallback@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" + lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" @@ -3807,6 +3837,13 @@ lodash.isarray@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" +lodash.isequal@^3.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-3.0.4.tgz#1c35eb3b6ef0cd1ff51743e3ea3cf7fdffdacb64" + dependencies: + lodash._baseisequal "^3.0.0" + lodash._bindcallback "^3.0.0" + lodash.isplainobject@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-3.2.0.tgz#9a8238ae16b200432960cd7346512d0123fbf4c5" @@ -3815,7 +3852,11 @@ lodash.isplainobject@^3.2.0: lodash.isarguments "^3.0.0" lodash.keysin "^3.0.0" -lodash.keys@^3.1.2: +lodash.istypedarray@^3.0.0: + version "3.0.6" + resolved "https://registry.yarnpkg.com/lodash.istypedarray/-/lodash.istypedarray-3.0.6.tgz#c9a477498607501d8e8494d283b87c39281cef62" + +lodash.keys@^3.0.0, lodash.keys@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" dependencies: