-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit uses Jest for testing everything instead of our homegrown combination of karma + mocha + expect. We were already using Jest to test react-router-redux and react-router-native, so this commit makes everything more consistent.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,4 @@ es | |
node_modules | ||
umd | ||
/*.js | ||
!karma.conf.js | ||
!tests.webpack.js | ||
!webpack.config.js |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,4 @@ es | |
node_modules | ||
umd | ||
/*.js | ||
!karma.conf.js | ||
!tests.webpack.js | ||
!webpack.config.js |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import expect from 'expect' | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import PropTypes from 'prop-types' | ||
|
@@ -24,21 +23,22 @@ describe('A <BrowserRouter>', () => { | |
</BrowserRouter> | ||
), node) | ||
|
||
expect(history).toBeAn('object') | ||
expect(typeof history).toBe('object') | ||
This comment has been minimized.
Sorry, something went wrong.
stryju
|
||
}) | ||
|
||
it('warns when passed a history prop', () => { | ||
const history = {} | ||
const node = document.createElement('div') | ||
expect.spyOn(console, 'error') | ||
|
||
spyOn(console, 'error') | ||
|
||
ReactDOM.render(( | ||
<BrowserRouter history={history} /> | ||
), node) | ||
|
||
expect(console.error.calls.length).toBe(1) | ||
expect(console.error.calls[0].arguments[0]).toMatch( | ||
/<BrowserRouter.*import \{ Router }/) | ||
expect.restoreSpies() | ||
expect(console.error.calls.count()).toBe(1) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
expect(console.error.calls.argsFor(0)[0]).toContain( | ||
This comment has been minimized.
Sorry, something went wrong.
stryju
|
||
'<BrowserRouter> ignores the history prop' | ||
) | ||
}) | ||
}) |
2 comments
on commit 172dc16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strong work @mjackson, this is awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 😅
we all love small modules, but we also all love getting rid of a bajillion deps! Nice work!