Skip to content

Commit 250cb34

Browse files
committed
Fix failing tests
1 parent dbfebdd commit 250cb34

File tree

4 files changed

+34
-18
lines changed

4 files changed

+34
-18
lines changed

modules/components/__tests__/DefaultRoute-test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,19 @@ describe('A DefaultRoute', function () {
6565
describe('when no child routes match a URL, but the parent\'s path matches', function () {
6666

6767
var component, rootRoute, defaultRoute;
68-
beforeEach(function () {
68+
beforeEach(function (done) {
6969
component = ReactTestUtils.renderIntoDocument(
70-
Routes({ location: 'none', initialPath: '/users/5' },
70+
Routes({ location: 'none' },
7171
rootRoute = Route({ name: 'user', path: '/users/:id', handler: NullHandler },
7272
Route({ name: 'home', path: '/users/:id/home', handler: NullHandler }),
7373
// Make it the middle sibling to test order independence.
7474
defaultRoute = DefaultRoute({ handler: NullHandler }),
7575
Route({ name: 'news', path: '/users/:id/news', handler: NullHandler })
7676
)
7777
)
78-
)
78+
);
79+
80+
component.dispatch('/users/5', done);
7981
});
8082

8183
afterEach(function () {

modules/components/__tests__/Link-test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ describe('A Link', function () {
1919
});
2020

2121
var component;
22-
beforeEach(function () {
22+
beforeEach(function (done) {
2323
component = ReactTestUtils.renderIntoDocument(
24-
Routes({ location: 'none', initialPath: '/mjackson/home' },
24+
Routes({ location: 'none' },
2525
Route({ name: 'home', path: '/:username/home', handler: HomeHandler })
2626
)
2727
);
28+
29+
component.dispatch('/mjackson/home', done);
2830
});
2931

3032
afterEach(function () {
@@ -45,12 +47,14 @@ describe('A Link', function () {
4547
});
4648

4749
var component;
48-
beforeEach(function () {
50+
beforeEach(function (done) {
4951
component = ReactTestUtils.renderIntoDocument(
50-
Routes({ location: 'none', initialPath: '/' },
52+
Routes({ location: 'none' },
5153
DefaultRoute({ name: 'home', handler: HomeHandler })
5254
)
5355
);
56+
57+
component.dispatch('/', done);
5458
});
5559

5660
afterEach(function () {

modules/components/__tests__/NotFoundRoute-test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,19 @@ describe('A NotFoundRoute', function () {
6363
describe('when no child routes match a URL, but the beginning of the parent\'s path matches', function () {
6464

6565
var component, rootRoute, notFoundRoute;
66-
beforeEach(function () {
66+
beforeEach(function (done) {
6767
component = ReactTestUtils.renderIntoDocument(
68-
Routes({ location: 'none', initialPath: '/users/5' },
68+
Routes({ location: 'none' },
6969
rootRoute = Route({ name: 'user', path: '/users/:id', handler: NullHandler },
7070
Route({ name: 'home', path: '/users/:id/home', handler: NullHandler }),
7171
// Make it the middle sibling to test order independence.
7272
notFoundRoute = NotFoundRoute({ handler: NullHandler }),
7373
Route({ name: 'news', path: '/users/:id/news', handler: NullHandler })
7474
)
7575
)
76-
)
76+
);
77+
78+
component.dispatch('/users/5', done);
7779
});
7880

7981
afterEach(function () {

modules/mixins/__tests__/Navigation-test.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ describe('Navigation', function () {
2020
describe('makePath', function () {
2121
describe('when there is a route with the given name', function () {
2222
var component;
23-
beforeEach(function () {
23+
beforeEach(function (done) {
2424
component = ReactTestUtils.renderIntoDocument(
25-
Routes({ initialPath: '/anybody/home' },
25+
Routes({ location: 'none' },
2626
Route({ name: 'home', path: '/:username/home', handler: NavigationHandler })
2727
)
2828
);
29+
30+
component.dispatch('/anybody/home', done);
2931
});
3032

3133
afterEach(function () {
@@ -41,12 +43,14 @@ describe('Navigation', function () {
4143

4244
describe('when there is no route with the given name', function () {
4345
var component;
44-
beforeEach(function () {
46+
beforeEach(function (done) {
4547
component = ReactTestUtils.renderIntoDocument(
46-
Routes({ initialPath: '/home' },
48+
Routes({ location: 'none' },
4749
Route({ name: 'home', handler: NavigationHandler })
4850
)
4951
);
52+
53+
component.dispatch('/home', done);
5054
});
5155

5256
afterEach(function () {
@@ -67,12 +71,14 @@ describe('Navigation', function () {
6771
describe('makeHref', function () {
6872
describe('when using "hash" location', function () {
6973
var component;
70-
beforeEach(function () {
74+
beforeEach(function (done) {
7175
component = ReactTestUtils.renderIntoDocument(
72-
Routes({ location: 'hash', initialPath: '/home' },
76+
Routes({ location: 'hash' },
7377
Route({ name: 'home', handler: NavigationHandler })
7478
)
7579
);
80+
81+
component.dispatch('/home', done);
7682
});
7783

7884
afterEach(function () {
@@ -88,12 +94,14 @@ describe('Navigation', function () {
8894

8995
describe('when using "history" location', function () {
9096
var component;
91-
beforeEach(function () {
97+
beforeEach(function (done) {
9298
component = ReactTestUtils.renderIntoDocument(
93-
Routes({ location: 'history', initialPath: '/home' },
99+
Routes({ location: 'history' },
94100
Route({ name: 'home', handler: NavigationHandler })
95101
)
96102
);
103+
104+
component.dispatch('/home', done);
97105
});
98106

99107
afterEach(function () {

0 commit comments

Comments
 (0)