Skip to content

[Cleanup] Convert container tests to new style - #15990

Merged
rwjblue merged 1 commit into
emberjs:masterfrom
t-sauer:container-test-style
Dec 18, 2017
Merged

rwjblue merged 1 commit into
emberjs:masterfrom
t-sauer:container-test-style

Conversation

@t-sauer

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

Copy link
Copy Markdown
Contributor

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

rwjblue commented Dec 16, 2017

Copy link
Copy Markdown
Member

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.

@rwjblue rwjblue left a comment

Copy link
Copy Markdown
Member

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...

Comment thread packages/container/tests/owner_test.js Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
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.

@thoov thoov Dec 16, 2017 •

Copy link
Copy Markdown
Member

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
t-sauer force-pushed the container-test-style branch from 21325bb to c2d3852 Compare December 16, 2017 23:52
@t-sauer

t-sauer commented Dec 16, 2017

Copy link
Copy Markdown
Contributor Author

Updated from this.assert to the assert argument.

@rwjblue

rwjblue commented Dec 18, 2017

Copy link
Copy Markdown
Member

Thank you!

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