Skip to content

Commit 7d52d55

Browse files
committed
[changed] TestLocation is a constructor
TestLocation is no longer a singleton. Instead, it's a constructor. This has the side effect that when a new TestLocation is created it automatically updates History.length. In practice this shouldn't be a problem any more than the singleton implementation was, since it still permits you to run only one test at a time.
1 parent 166b9a2 commit 7d52d55

File tree

8 files changed

+168
-159
lines changed

8 files changed

+168
-159
lines changed

modules/__tests__/History-test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ describe('History', function () {
1414
});
1515

1616
describe('after navigating to a route', function () {
17+
var location;
1718
beforeEach(function () {
18-
TestLocation.history = [ '/foo' ];
19+
location = new TestLocation([ '/foo' ]);
1920
});
2021

2122
it('has length 2', function (done) {
@@ -26,7 +27,7 @@ describe('History', function () {
2627

2728
var count = 0;
2829

29-
var router = Router.run(routes, TestLocation, function (Handler) {
30+
var router = Router.run(routes, location, function (Handler) {
3031
count += 1;
3132

3233
if (count === 2) {
@@ -47,7 +48,7 @@ describe('History', function () {
4748

4849
var count = 0;
4950

50-
var router = Router.run(routes, TestLocation, function (Handler) {
51+
var router = Router.run(routes, location, function (Handler) {
5152
count += 1;
5253

5354
if (count === 2) {

0 commit comments

Comments
 (0)