Skip to content

Commit

Permalink
Pass resolver to Test app in generated initializer test
Browse files Browse the repository at this point in the history
The default resolver (the globals resolver is deprecated), so we
always need to pass this in.

Closes #19046

(cherry picked from commit fa35230)
  • Loading branch information
Mehul Kar authored and kategengler committed Aug 17, 2020
1 parent 4f22235 commit cae7077
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import Application from '@ember/application';

import { initialize } from '<%= modulePrefix %>/initializers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import Resolver from 'ember-resolver';
<% if (destroyAppExists) { %>import destroyApp from '../../helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop';<% } %>

module('<%= friendlyTestName %>', function(hooks) {
hooks.beforeEach(function() {
this.TestApplication = Application.extend();
this.TestApplication = class TestApplication extends Application {}
this.TestApplication.initializer({
name: 'initializer under test',
initialize
});

this.application = this.TestApplication.create({ autoboot: false });
this.application = this.TestApplication.create({ autoboot: false, Resolver });
});

hooks.afterEach(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import Application from '@ember/application';

import { initialize } from '<%= modulePrefix %>/instance-initializers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import Resolver from 'ember-resolver';
<% if (destroyAppExists) { %>import destroyApp from '../../helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop';<% } %>

module('<%= friendlyTestName %>', function(hooks) {
hooks.beforeEach(function() {
this.TestApplication = Application.extend();
this.TestApplication = class TestApplication extends Application {}
this.TestApplication.instanceInitializer({
name: 'initializer under test',
initialize
});
this.application = this.TestApplication.create({ autoboot: false });
this.application = this.TestApplication.create({ autoboot: false, Resolver });
this.instance = this.application.buildInstance();
});
hooks.afterEach(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import Application from '@ember/application';

import { initialize } from 'my-app/init/initializers/foo';
import { module, test } from 'qunit';
import Resolver from 'ember-resolver';
import { run } from '@ember/runloop';

module('Unit | Initializer | foo', function(hooks) {
hooks.beforeEach(function() {
this.TestApplication = Application.extend();
this.TestApplication = class TestApplication extends Application {}
this.TestApplication.initializer({
name: 'initializer under test',
initialize
});

this.application = this.TestApplication.create({ autoboot: false });
this.application = this.TestApplication.create({ autoboot: false, Resolver });
});

hooks.afterEach(function() {
Expand Down
5 changes: 3 additions & 2 deletions node-tests/fixtures/initializer-test/rfc232.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import Application from '@ember/application';

import { initialize } from 'my-app/initializers/foo';
import { module, test } from 'qunit';
import Resolver from 'ember-resolver';
import { run } from '@ember/runloop';

module('Unit | Initializer | foo', function(hooks) {
hooks.beforeEach(function() {
this.TestApplication = Application.extend();
this.TestApplication = class TestApplication extends Application {}
this.TestApplication.initializer({
name: 'initializer under test',
initialize
});

this.application = this.TestApplication.create({ autoboot: false });
this.application = this.TestApplication.create({ autoboot: false, Resolver });
});

hooks.afterEach(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import Application from '@ember/application';

import { initialize } from 'my-app/init/instance-initializers/foo';
import { module, test } from 'qunit';
import Resolver from 'ember-resolver';
import { run } from '@ember/runloop';

module('Unit | Instance Initializer | foo', function(hooks) {
hooks.beforeEach(function() {
this.TestApplication = Application.extend();
this.TestApplication = class TestApplication extends Application {}
this.TestApplication.instanceInitializer({
name: 'initializer under test',
initialize
});
this.application = this.TestApplication.create({ autoboot: false });
this.application = this.TestApplication.create({ autoboot: false, Resolver });
this.instance = this.application.buildInstance();
});
hooks.afterEach(function() {
Expand Down
5 changes: 3 additions & 2 deletions node-tests/fixtures/instance-initializer-test/rfc232.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import Application from '@ember/application';

import { initialize } from 'my-app/instance-initializers/foo';
import { module, test } from 'qunit';
import Resolver from 'ember-resolver';
import { run } from '@ember/runloop';

module('Unit | Instance Initializer | foo', function(hooks) {
hooks.beforeEach(function() {
this.TestApplication = Application.extend();
this.TestApplication = class TestApplication extends Application {}
this.TestApplication.instanceInitializer({
name: 'initializer under test',
initialize
});
this.application = this.TestApplication.create({ autoboot: false });
this.application = this.TestApplication.create({ autoboot: false, Resolver });
this.instance = this.application.buildInstance();
});
hooks.afterEach(function() {
Expand Down

0 comments on commit cae7077

Please sign in to comment.