Skip to content

Commit

Permalink
Merge pull request #1851 from alexlande/bug-routesWithHash
Browse files Browse the repository at this point in the history
Add failing tests for route matching with hash
  • Loading branch information
ryanflorence committed Sep 11, 2015
2 parents 0ef60cc + 809397d commit d32b20d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions modules/__tests__/matchRoutes-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,27 @@ describe('matchRoutes', function () {
});
});

describe('when the location matches a route with hash', function () {
it('matches the correct routes', function (done) {
matchRoutes(routes, createLocation('/users#about'), function (error, match) {
assert(match);
expect(match.routes).toEqual([ RootRoute, UsersRoute, UsersIndexRoute ]);
done();
});
});
});

describe('when the location matches a deeply nested route with params and hash', function () {
it('matches the correct routes and params', function (done) {
matchRoutes(routes, createLocation('/users/5/abc#about'), function (error, match) {
assert(match);
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, PostRoute ]);
expect(match.params).toEqual({ userID: '5', postID: 'abc' });
done();
});
});
});

describe('when the location matches an absolute route', function () {
it('matches the correct routes', function (done) {
matchRoutes(routes, createLocation('/about'), function (error, match) {
Expand Down

0 comments on commit d32b20d

Please sign in to comment.