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

[Cleanup] Convert container tests to new style #15990

Merged
merged 1 commit into from
Dec 18, 2017

Conversation

t-sauer
Copy link
Contributor

@t-sauer t-sauer commented Dec 15, 2017

See #15988

Two things I observed while converting:

  • expectAssertion and expectDeprecation are not available on this.assert. Is this intended? Is there a newer replacement for that?
  • There are a couple of assert.expect(1) which is not needed as far as I know, correct?

@rwjblue
Copy link
Member

rwjblue commented Dec 16, 2017

expectAssertion and expectDeprecation are not available on this.assert. Is this intended? Is there a newer replacement for that?

Yes, we should migrate to a custom assert.throws implementation (basically something that is aware of production and "does the right thing"). Definitely fodder for a future quest issue...

There are a couple of assert.expect(1) which is not needed as far as I know, correct?

Correct, however when assertions are not in the top down flow of code I do think we should have an assert.expect. Basically require-expect with the except-simple config option.

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 to me, I only have one general comment around using assert argument instead of this.assert, but I'm happy to tackle that in a follow up...


QUnit.module('Owner', {});
moduleFor('Owner', class extends AbstractTestCase {
['@test An owner can be set with `setOwner` and retrieved with `getOwner`']() {
Copy link
Member

Choose a reason for hiding this comment

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

I'd generally prefer to add assert as the callback arg and use it below (instead of this.assert). It is simpler, and "feels" more idiomatic to me.

@chancancode / @thoov / @locks - Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I've been doing this.assert because of the code linked in the quest issue, but I prefer the argument version too.

Copy link
Member

@thoov thoov Dec 16, 2017

Choose a reason for hiding this comment

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

I agree with having assert as an argument over off of this. Definitely is more "standard" when looking at docs and existing testing approaches in the wild. I will update the issue to have more clear explanations about things we are looking for and better examples

@t-sauer
Copy link
Contributor Author

t-sauer commented Dec 16, 2017

Updated from this.assert to the assert argument.

@rwjblue
Copy link
Member

rwjblue commented Dec 18, 2017

Thank you!

@rwjblue rwjblue merged commit b4aca96 into emberjs:master Dec 18, 2017
@thoov thoov mentioned this pull request Jan 5, 2018
14 tasks
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.

4 participants