Skip to content

Commit b3f50a0

Browse files
committed
Update expect dep and remove assert dep
1 parent 4f0c9f6 commit b3f50a0

File tree

4 files changed

+18
-27
lines changed

4 files changed

+18
-27
lines changed

modules/__tests__/Link-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*eslint-env mocha */
22
/*eslint react/prop-types: 0*/
3-
import assert from 'assert'
43
import expect from 'expect'
54
import React from 'react'
65
import ReactTestUtils from 'react-addons-test-utils'
@@ -267,11 +266,10 @@ describe('A <Link>', function () {
267266
class LinkWrapper extends React.Component {
268267
handleClick(event) {
269268
event.preventDefault()
270-
assert.ok(true)
271269
done()
272270
}
273271
render() {
274-
return <Link to="/hello" onClick={(e) => this.handleClick(e)}>Link</Link>
272+
return <Link to="/hello" onClick={e => this.handleClick(e)}>Link</Link>
275273
}
276274
}
277275

modules/__tests__/RouteComponent-test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ describe('a Route Component', function () {
1919
it('injects the right props', function (done) {
2020
class Parent extends React.Component {
2121
componentDidMount() {
22-
assertProps(this.props)
22+
expect(this.props.route).toEqual(parent)
23+
expect(this.props.routes).toEqual([ parent, child ])
2324
}
2425
render() {
2526
return null
@@ -35,11 +36,6 @@ describe('a Route Component', function () {
3536
const child = { path: 'child', component: Child }
3637
const parent = { path: '/', component: Parent, childRoutes: [ child ] }
3738

38-
function assertProps(props) {
39-
expect(props.route).toEqual(parent)
40-
expect(props.routes).toEqual([ parent, child ])
41-
}
42-
4339
render((
4440
<Router history={createHistory('/child')} routes={parent}/>
4541
), node, done)

modules/__tests__/matchRoutes-test.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
/*eslint-env mocha */
2-
import React from 'react'
3-
import Route from '../Route'
4-
5-
import assert from 'assert'
62
import expect from 'expect'
3+
import React from 'react'
74
import { createMemoryHistory } from 'history'
85
import { createRoutes } from '../RouteUtils'
96
import matchRoutes from '../matchRoutes'
7+
import Route from '../Route'
108

119
describe('matchRoutes', function () {
1210

@@ -67,7 +65,7 @@ describe('matchRoutes', function () {
6765
describe('when the location matches an index route', function () {
6866
it('matches the correct routes', function (done) {
6967
matchRoutes(routes, createLocation('/users'), function (error, match) {
70-
assert(match)
68+
expect(match).toExist()
7169
expect(match.routes).toEqual([ RootRoute, UsersRoute, UsersIndexRoute ])
7270
done()
7371
})
@@ -77,7 +75,7 @@ describe('matchRoutes', function () {
7775
describe('when the location matches a nested route with params', function () {
7876
it('matches the correct routes and params', function (done) {
7977
matchRoutes(routes, createLocation('/users/5'), function (error, match) {
80-
assert(match)
78+
expect(match).toExist()
8179
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute ])
8280
expect(match.params).toEqual({ userID: '5' })
8381
done()
@@ -88,7 +86,7 @@ describe('matchRoutes', function () {
8886
describe('when the location matches a deeply nested route with params', function () {
8987
it('matches the correct routes and params', function (done) {
9088
matchRoutes(routes, createLocation('/users/5/abc'), function (error, match) {
91-
assert(match)
89+
expect(match).toExist()
9290
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, PostRoute ])
9391
expect(match.params).toEqual({ userID: '5', postID: 'abc' })
9492
done()
@@ -99,7 +97,7 @@ describe('matchRoutes', function () {
9997
describe('when the location matches a nested route with multiple splat params', function () {
10098
it('matches the correct routes and params', function (done) {
10199
matchRoutes(routes, createLocation('/files/a/b/c.jpg'), function (error, match) {
102-
assert(match)
100+
expect(match).toExist()
103101
expect(match.routes).toEqual([ FilesRoute ])
104102
expect(match.params).toEqual({ splat: [ 'a', 'b/c' ] })
105103
done()
@@ -110,7 +108,7 @@ describe('matchRoutes', function () {
110108
describe('when the location matches a route with hash', function () {
111109
it('matches the correct routes', function (done) {
112110
matchRoutes(routes, createLocation('/users#about'), function (error, match) {
113-
assert(match)
111+
expect(match).toExist()
114112
expect(match.routes).toEqual([ RootRoute, UsersRoute, UsersIndexRoute ])
115113
done()
116114
})
@@ -120,7 +118,7 @@ describe('matchRoutes', function () {
120118
describe('when the location matches a deeply nested route with params and hash', function () {
121119
it('matches the correct routes and params', function (done) {
122120
matchRoutes(routes, createLocation('/users/5/abc#about'), function (error, match) {
123-
assert(match)
121+
expect(match).toExist()
124122
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, PostRoute ])
125123
expect(match.params).toEqual({ userID: '5', postID: 'abc' })
126124
done()
@@ -131,7 +129,7 @@ describe('matchRoutes', function () {
131129
describe('when the location matches an absolute route', function () {
132130
it('matches the correct routes', function (done) {
133131
matchRoutes(routes, createLocation('/about'), function (error, match) {
134-
assert(match)
132+
expect(match).toExist()
135133
expect(match.routes).toEqual([ AboutRoute ])
136134
done()
137135
})
@@ -141,7 +139,7 @@ describe('matchRoutes', function () {
141139
describe('when the location does not match any routes', function () {
142140
it('matches the "catch-all" route', function (done) {
143141
matchRoutes(routes, createLocation('/not-found'), function (error, match) {
144-
assert(match)
142+
expect(match).toExist()
145143
expect(match.routes).toEqual([ CatchAllRoute ])
146144
done()
147145
})
@@ -155,7 +153,7 @@ describe('matchRoutes', function () {
155153
describe('when the location matches a nested absolute route', function () {
156154
it('matches the correct routes', function (done) {
157155
matchRoutes(routes, createLocation('/team'), function (error, match) {
158-
assert(match)
156+
expect(match).toExist()
159157
expect(match.routes).toEqual([ RootRoute, UsersRoute, TeamRoute ])
160158
done()
161159
})
@@ -165,7 +163,7 @@ describe('matchRoutes', function () {
165163
describe('when the location matches an absolute route nested under a route with params', function () {
166164
it('matches the correct routes and params', function (done) {
167165
matchRoutes(routes, createLocation('/profile'), function (error, match) {
168-
assert(match)
166+
expect(match).toExist()
169167
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, ProfileRoute ])
170168
expect(match.params).toEqual({}) // no userID param
171169
done()
@@ -236,7 +234,7 @@ describe('matchRoutes', function () {
236234

237235
it('when getChildRoutes callback returns reactElements', function (done) {
238236
matchRoutes(jsxRoutes, createLocation('/users/5'), function (error, match) {
239-
assert(match)
237+
expect(match).toExist()
240238
expect(match.routes.map(r => r.path)).toEqual([ 'users', ':userID' ])
241239
expect(match.params).toEqual({ userID: '5' })
242240
done()
@@ -245,7 +243,7 @@ describe('matchRoutes', function () {
245243

246244
it('when getIndexRoute callback returns reactElements', function (done) {
247245
matchRoutes(jsxRoutes, createLocation('/users'), function (error, match) {
248-
assert(match)
246+
expect(match).toExist()
249247
expect(match.routes.map(r => r.name)).toEqual([ 'users', 'jsx' ])
250248
done()
251249
})

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"warning": "^2.0.0"
3030
},
3131
"devDependencies": {
32-
"assert": "1.3.0",
3332
"babel": "^5.4.7",
3433
"babel-core": "^5.4.7",
3534
"babel-eslint": "^3.1.23",
@@ -38,7 +37,7 @@
3837
"css-loader": "^0.19.0",
3938
"eslint": "1.4.0",
4039
"eslint-plugin-react": "3.3.2",
41-
"expect": "1.10.0",
40+
"expect": "^1.12.0",
4241
"express": "^4.13.3",
4342
"express-urlrewrite": "^1.2.0",
4443
"karma": "^0.13.8",

0 commit comments

Comments
 (0)