Skip to content

Commit 0d246e7

Browse files
pichflmansona
authored andcommitted
Unskip router_js tests
1 parent e99a7b2 commit 0d246e7

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

packages/router_js/tests/router_test.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
transitionTo,
2828
transitionToWithAbort,
2929
trigger,
30-
skip,
3130
} from './test_helpers';
3231

3332
let router: Router<Route>;
@@ -1725,7 +1724,7 @@ scenarios.forEach(function (scenario) {
17251724
});
17261725
});
17271726

1728-
skip('error route events', function (assert) {
1727+
test('error route events', function (assert) {
17291728
map(assert, function (match) {
17301729
match('/').to('index');
17311730
match('/posts', function (match) {
@@ -1822,7 +1821,7 @@ scenarios.forEach(function (scenario) {
18221821
}
18231822
};
18241823

1825-
router
1824+
const transition = router
18261825
.transitionTo('/')
18271826
.then(() => {
18281827
return router.transitionTo('/posts/1');
@@ -1835,6 +1834,8 @@ scenarios.forEach(function (scenario) {
18351834
assert.equal(enteredWillChange, 4);
18361835
assert.equal(enteredDidChange, 2);
18371836
});
1837+
1838+
assert.rejects(transition);
18381839
});
18391840

18401841
test("when transitioning to a new parent and child state, the parent's context should be available to the child's model", function (assert) {
@@ -3452,8 +3453,8 @@ scenarios.forEach(function (scenario) {
34523453
});
34533454
});
34543455

3455-
skip("Errors shouldn't be handled after proceeding to next child route", function (assert) {
3456-
assert.expect(3);
3456+
test("Errors shouldn't be handled after proceeding to next child route", function (assert) {
3457+
assert.expect(4);
34573458

34583459
map(assert, function (match) {
34593460
match('/parent').to('parent', function (match) {
@@ -3466,7 +3467,7 @@ scenarios.forEach(function (scenario) {
34663467
articles: createHandler('articles', {
34673468
beforeModel: function () {
34683469
assert.ok(true, 'articles beforeModel was entered');
3469-
return reject('blorg');
3470+
return Promise.reject('blorg in beforeModel in articles');
34703471
},
34713472
events: {
34723473
error: function () {
@@ -3491,7 +3492,8 @@ scenarios.forEach(function (scenario) {
34913492
}),
34923493
};
34933494

3494-
router.handleURL('/parent/articles');
3495+
let transition = router.handleURL('/parent/articles');
3496+
assert.rejects(transition as unknown as Promise<any>);
34953497
});
34963498

34973499
test("Error handling shouldn't trigger for transitions that are already aborted", function (assert) {
@@ -3995,7 +3997,7 @@ scenarios.forEach(function (scenario) {
39953997
});
39963998
});
39973999

3998-
skip('aborted transitions can be saved and later retried asynchronously', function (assert) {
4000+
test('aborted transitions can be saved and later retried asynchronously', function (assert) {
39994001
assert.expect(2);
40004002

40014003
let abortedTransition: Transition;
@@ -4006,7 +4008,9 @@ scenarios.forEach(function (scenario) {
40064008
willTransition: function (transition: Transition) {
40074009
if (shouldPrevent) {
40084010
abortedTransition = transition.abort();
4009-
router.intermediateTransitionTo('loading');
4011+
4012+
const t = router.intermediateTransitionTo('loading');
4013+
assert.rejects(t as unknown as Promise<any>);
40104014
}
40114015
},
40124016
},
@@ -6418,7 +6422,7 @@ scenarios.forEach(function (scenario) {
64186422
assert.equal(projectSetupCount, 2, 'project handler should have been setup twice');
64196423
});
64206424

6421-
skip('synchronous transition errors can be detected synchronously', function (assert) {
6425+
test('synchronous transition errors can be detected synchronously', function (assert) {
64226426
map(assert, function (match) {
64236427
match('/').to('root');
64246428
});
@@ -6427,6 +6431,9 @@ scenarios.forEach(function (scenario) {
64276431
throw new Error('boom!');
64286432
};
64296433

6430-
assert.equal((transitionTo(router, '/').error as Error).message, 'boom!');
6434+
const transition = transitionTo(router, '/');
6435+
6436+
assert.rejects(transition as unknown as Promise<any>);
6437+
assert.equal((transition.error as Error).message, 'boom!');
64316438
});
64326439
});

0 commit comments

Comments
 (0)