Skip to content

Commit

Permalink
Merge pull request #1203 from emberjs/ensure-integration-tests-work
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed May 12, 2020
2 parents c9d8359 + 08ef352 commit 590d69d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/helpers/setup-destroy-ei-app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Application from '@ember/application';
import EmberRouter from '@ember/routing/router';
import {
getApplication,
setApplication,
setupApplicationContext,
setupContext,
Expand All @@ -10,7 +11,6 @@ import {
import { assert } from '@ember/debug';
import { run } from '@ember/runloop';


export async function setupEIApp(EmberDebug, routes) {
assert('setupEIApp requires `EmberDebug` to be passed.', EmberDebug !== undefined);

Expand All @@ -28,6 +28,7 @@ export async function setupEIApp(EmberDebug, routes) {
});
App.register('router:main', Router);

this._originalApp = getApplication();
await setApplication(App);
await setupContext(this);
await setupApplicationContext(this);
Expand All @@ -50,5 +51,8 @@ export async function destroyEIApp(EmberDebug, App) {
EmberDebug.destroyContainer();
await teardownApplicationContext(this);
await teardownContext(this);
return run(App, 'destroy');

run(App, 'destroy');

setApplication(this._originalApp);
}
14 changes: 14 additions & 0 deletions tests/integration/components/basic-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | basic', function(hooks) {
setupRenderingTest(hooks);

test('generally works', async function(assert) {
await render(hbs`Hello world!`);

assert.equal(this.element.textContent.trim(), 'Hello world!');
});
});

0 comments on commit 590d69d

Please sign in to comment.