Skip to content

Commit

Permalink
Merge pull request #1889 from ember-learn/jw-setuptest
Browse files Browse the repository at this point in the history
Update setupTest function imports
  • Loading branch information
jenweber authored Jan 5, 2023
2 parents 4f3fa71 + ea232fe commit f7ed18e
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You can test that page titles are generated correctly by asserting on the value
```javascript {data-filename=tests/acceptance/posts-test.js}
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupApplicationTest } from 'my-app-name/tests/helpers';

module('Acceptance | posts', function(hooks) {
setupApplicationTest(hooks);
Expand Down
6 changes: 3 additions & 3 deletions guides/release/testing/test-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ When unit tests involve the Ember framework, you must import and call [`setupTes
For example, consider a service that keeps an array of messages, to be shown to the user at a later time:

```javascript {data-filename=tests/unit/services/flash-messages-test.js}
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';
import { module, test } from 'qunit';

module('Unit | Service | flash-messages', function(hooks) {
Expand Down Expand Up @@ -113,7 +113,7 @@ Consider a button component. For simplicity, assume that the component keeps tra

```javascript {data-filename=tests/integration/components/simple-button-test.js}
import { click, render } from '@ember/test-helpers';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { hbs } from 'ember-cli-htmlbars';
import { module, test } from 'qunit';

Expand Down Expand Up @@ -174,7 +174,7 @@ Let's continue with the blog post example from [Rendering Tests](../test-types/#

```javascript {data-filename=tests/acceptance/posts-test.js}
import { click, currentURL, fillIn, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupApplicationTest } from 'my-app-name/tests/helpers';
import { module, test } from 'qunit';

module('Acceptance | posts', function(hooks) {
Expand Down
4 changes: 2 additions & 2 deletions guides/release/testing/testing-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This generates this file:
```javascript {data-filename=tests/acceptance/login-test.js}
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupApplicationTest } from 'my-app-name/tests/helpers';

module('Acceptance | login', function(hooks) {
setupApplicationTest(hooks);
Expand All @@ -37,7 +37,7 @@ For example:
```javascript {data-filename=tests/acceptance/new-post-appears-first-test.js}
import { module, test } from 'qunit';
import { click, fillIn, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupApplicationTest } from 'my-app-name/tests/helpers';

module('Acceptance | posts', function(hooks) {
setupApplicationTest(hooks);
Expand Down
22 changes: 11 additions & 11 deletions guides/release/testing/testing-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and cleaning up once your tests in this module are finished.

```javascript {data-filename="tests/integration/components/pretty-color-test.js"}
import { module } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';

module('Integration | Component | pretty-color', function(hooks) {
setupRenderingTest(hooks);
Expand All @@ -44,7 +44,7 @@ Here, we can use the `QUnit.test` helper and we can give it a descriptive name:

```javascript {data-filename="tests/integration/components/pretty-color-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';

module('Integration | Component | pretty-color', function(hooks) {
setupRenderingTest(hooks);
Expand All @@ -63,7 +63,7 @@ We can better see what this means, once we start writing out our first test case

```javascript {data-filename="tests/integration/components/pretty-color-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand Down Expand Up @@ -94,7 +94,7 @@ component's `style` attribute and is reflected in the rendered HTML:

```javascript {data-filename="tests/integration/components/pretty-color-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand All @@ -121,7 +121,7 @@ We might also test this component to ensure that the content of its template is

```javascript {data-filename="tests/integration/components/pretty-color-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand Down Expand Up @@ -181,7 +181,7 @@ And our test might look like this:

```javascript {data-filename="tests/integration/components/magic-title-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { click, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand Down Expand Up @@ -246,7 +246,7 @@ external action is called:

```javascript {data-filename="tests/integration/components/comment-form-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { click, fillIn, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand Down Expand Up @@ -324,7 +324,7 @@ In this case we initially force location to "New York".

```javascript {data-filename="tests/integration/components/location-indicator-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import Service from '@ember/service';
Expand Down Expand Up @@ -361,7 +361,7 @@ the test needs to check that the stub data from the service is reflected in the

```javascript {data-filename="tests/integration/components/location-indicator-test.js" data-diff="+30,+31,+32,+33,+34,+35"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import Service from '@ember/service';
Expand Down Expand Up @@ -403,7 +403,7 @@ In the next example, we'll add another test that validates that the display chan

```javascript {data-filename="tests/integration/components/location-indicator-test.js" data-diff="+36,+37,+38,+39,+40,+41,+42,+43,+44,+45,+46,+47,+48,+49,+50"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import Service from '@ember/service';
Expand Down Expand Up @@ -509,7 +509,7 @@ In your test, use the `settled` helper to wait until your debounce timer is up a

```javascript {data-filename="tests/integration/components/delayed-typeahead-test.js"}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render, settled } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand Down
4 changes: 2 additions & 2 deletions guides/release/testing/testing-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ container:

```javascript {data-filename=tests/unit/controllers/posts-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

module('Unit | Controller | posts', function(hooks) {
setupTest(hooks);
Expand All @@ -52,7 +52,7 @@ and is also exposed in tests for your usage. Here it will return a singleton ins

```javascript {data-filename=tests/unit/controllers/posts-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

module('Unit | Controller | posts', function(hooks) {
setupTest(hooks);
Expand Down
4 changes: 2 additions & 2 deletions guides/release/testing/testing-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ in [Testing Components](../testing-components/).

```javascript {data-filename=tests/integration/helpers/format-currency-test.js}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand All @@ -75,7 +75,7 @@ We can now also properly test if a helper will respond to property changes.

```javascript {data-filename=tests/integration/helpers/format-currency-test.js}
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app-name/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand Down
4 changes: 2 additions & 2 deletions guides/release/testing/testing-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ level 4 to assert that the `levelName` changes. We will use `module` together wi

```javascript {data-filename=tests/unit/models/player-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';
import { run } from '@ember/runloop';

module('Unit | Model | player', function(hooks) {
Expand Down Expand Up @@ -85,7 +85,7 @@ Then you could test that the relationship by looking it up on the `user` model w

```javascript {data-filename=tests/unit/models/user-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';
import { get } from '@ember/object';

module('Unit | Model | user', function(hooks) {
Expand Down
2 changes: 1 addition & 1 deletion guides/release/testing/testing-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Here is an example of test this route in an isolated test case:

```javascript {data-filename=tests/unit/routes/application-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

let originalAlert;

Expand Down
10 changes: 5 additions & 5 deletions guides/release/testing/unit-testing-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ computed property is working correctly.

```javascript {data-filename=tests/unit/service/some-thing-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

module('Unit | Service | some thing', function(hooks) {
setupTest(hooks);
Expand Down Expand Up @@ -80,7 +80,7 @@ result of the method call.

```javascript {data-filename=tests/unit/services/some-thing-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

module('Unit | Service | some thing', function(hooks) {
setupTest(hooks);
Expand Down Expand Up @@ -117,7 +117,7 @@ The test would call the `calc` method and assert it gets back the correct value.

```javascript {data-filename=tests/unit/services/some-thing-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

module('Unit | Service | some thing', function(hooks) {
setupTest(hooks);
Expand Down Expand Up @@ -179,7 +179,7 @@ out which method the error is in. In we stub the other method:

```javascript {data-filename=tests/unit/services/some-thing-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

module('Unit | Service | some thing', function(hooks) {
setupTest(hooks);
Expand Down Expand Up @@ -223,7 +223,7 @@ Instead, create a simple object and pass it instead.

```javascript {data-filename=tests/unit/services/employees-test.js}
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app-name/tests/helpers';

module('Unit | Service | employees', function(hooks) {
setupTest(hooks);
Expand Down

0 comments on commit f7ed18e

Please sign in to comment.