diff --git a/blueprints/instance-initializer-test/qunit-rfc-232-files/tests/unit/instance-initializers/__name__-test.js b/blueprints/instance-initializer-test/qunit-rfc-232-files/tests/unit/instance-initializers/__name__-test.js new file mode 100644 index 00000000000..9782808f480 --- /dev/null +++ b/blueprints/instance-initializer-test/qunit-rfc-232-files/tests/unit/instance-initializers/__name__-test.js @@ -0,0 +1,31 @@ +import Application from '@ember/application'; + +import { initialize } from '<%= dasherizedModulePrefix %>/instance-initializers/<%= dasherizedModuleName %>'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; +import destroyApp from '../../helpers/destroy-app'; + +module('<%= friendlyTestName %>', function(hooks) { + setupTest(hooks); + + hooks.beforeEach(function() { + this.TestApplication = Application.extend(); + this.TestApplication.instanceInitializer({ + name: 'initializer under test', + initialize + }); + this.application = this.TestApplication.create({ autoboot: false }); + this.instance = this.application.buildInstance(); + }); + hooks.afterEach(function() { + destroyApp(this.application); + destroyApp(this.instance); + }); + + // Replace this with your real tests. + test('it works', async function(assert) { + await this.instance.boot(); + + assert.ok(true); + }); +}); diff --git a/node-tests/blueprints/instance-initializer-test-test.js b/node-tests/blueprints/instance-initializer-test-test.js index a98d25aa492..deef587b9d6 100644 --- a/node-tests/blueprints/instance-initializer-test-test.js +++ b/node-tests/blueprints/instance-initializer-test-test.js @@ -9,6 +9,7 @@ const modifyPackages = blueprintHelpers.modifyPackages; const chai = require('ember-cli-blueprint-test-helpers/chai'); const expect = chai.expect; +const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest'); const fixture = require('../helpers/fixture'); describe('Blueprint: instance-initializer-test', function() { @@ -26,6 +27,19 @@ describe('Blueprint: instance-initializer-test', function() { }); }); + describe('with ember-cli-qunit@4.1.1', function() { + beforeEach(function() { + generateFakePackageManifest('ember-cli-qunit', '4.1.1'); + }); + + it('instance-initializer-test foo', function() { + return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => { + expect(_file('tests/unit/instance-initializers/foo-test.js')) + .to.equal(fixture('instance-initializer-test/rfc232.js')); + }); + }); + }); + describe('with ember-cli-mocha', function() { beforeEach(function() { modifyPackages([ diff --git a/node-tests/fixtures/instance-initializer-test/rfc232.js b/node-tests/fixtures/instance-initializer-test/rfc232.js new file mode 100644 index 00000000000..d3378f08aef --- /dev/null +++ b/node-tests/fixtures/instance-initializer-test/rfc232.js @@ -0,0 +1,31 @@ +import Application from '@ember/application'; + +import { initialize } from 'my-app/instance-initializers/foo'; +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; +import destroyApp from '../../helpers/destroy-app'; + +module('Unit | Instance Initializer | foo', function(hooks) { + setupTest(hooks); + + hooks.beforeEach(function() { + this.TestApplication = Application.extend(); + this.TestApplication.instanceInitializer({ + name: 'initializer under test', + initialize + }); + this.application = this.TestApplication.create({ autoboot: false }); + this.instance = this.application.buildInstance(); + }); + hooks.afterEach(function() { + destroyApp(this.application); + destroyApp(this.instance); + }); + + // Replace this with your real tests. + test('it works', async function(assert) { + await this.instance.boot(); + + assert.ok(true); + }); +});