Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] assert transitions on destroyed app instances #16386

Merged
merged 2 commits into from
Mar 22, 2018

Conversation

runspired
Copy link
Contributor

No description provided.

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Can you add a test for the assertion also?


router.currentRouteName = 'route-a';

assert.throws(function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since assertions are stripped in production builds (and we run tests against production builds) this will need to be tweaked. The main update should be to replace assert.throws with expectAssertion (which is a global).


assert.throws(function() {
router.transitionTo('route-b');
}, "A transition was attempted from 'route-a' to 'route-b' but the application instance has already been destroyed.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work fine once you migrate to expectAssertion, but I figured I’d point out that this definitely doesn’t do what you expect with assert.throws. Specifically, passing assert.throws two arguments (a function and a string) does not use the provided string as a matcher for the error message but instead uses the second arg as the label for the assertion. It’s a super super trolly api 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sad face

@runspired runspired force-pushed the assert-transitions-on-destroy branch from 21b50c4 to 246e16a Compare March 22, 2018 00:32
Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 Failed assertion: Expected failing Ember.assert: 'A transition was attempted from 'route-a' to 'route-b' but the application instance has already been destroyed.', but got 'The route route-b was not found'., expected: A transition was attempted from 'route-a' to 'route-b' but the application instance has already been destroyed.

@runspired
Copy link
Contributor Author

@rwjblue odd. That test was running fine locally. I’ll take a peek.

@stefanpenner stefanpenner merged commit 39bbf0b into emberjs:master Mar 22, 2018
@runspired runspired deleted the assert-transitions-on-destroy branch March 22, 2018 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants