diff --git a/blueprints/helper-test/index.js b/blueprints/helper-test/index.js index 43a1ad7dbd3..ce26638309b 100644 --- a/blueprints/helper-test/index.js +++ b/blueprints/helper-test/index.js @@ -7,29 +7,15 @@ const semver = require('semver'); const useTestFrameworkDetector = require('../test-framework-detector'); module.exports = useTestFrameworkDetector({ - description: 'Generates a helper integration test or a unit test.', - - availableOptions: [ - { - name: 'test-type', - type: ['integration', 'unit'], - default: 'integration', - aliases: [ - { i: 'integration' }, - { u: 'unit' }, - { integration: 'integration' }, - { unit: 'unit' }, - ], - }, - ], + description: 'Generates a helper integration test.', fileMapTokens: function () { return { __root__() { return 'tests'; }, - __testType__(options) { - return options.locals.testType || 'integration'; + __testType__() { + return 'integration'; }, __collection__() { return 'helpers'; @@ -38,9 +24,7 @@ module.exports = useTestFrameworkDetector({ }, locals: function (options) { - let testType = options.testType || 'integration'; - let testName = testType === 'integration' ? 'Integration' : 'Unit'; - let friendlyTestName = [testName, 'Helper', options.entity.name].join(' | '); + let friendlyTestName = ['Integration', 'Helper', options.entity.name].join(' | '); let dasherizedModulePrefix = stringUtils.dasherize(options.project.config().modulePrefix); let hbsImportStatement = this._useNamedHbsImport() @@ -48,7 +32,6 @@ module.exports = useTestFrameworkDetector({ : "import hbs from 'htmlbars-inline-precompile';"; return { - testType, friendlyTestName, dasherizedModulePrefix, hbsImportStatement, @@ -68,7 +51,6 @@ module.exports = useTestFrameworkDetector({ afterInstall: function (options) { if ( !options.dryRun && - options.testType === 'integration' && !this._useNamedHbsImport() && isPackageMissing(this, 'ember-cli-htmlbars-inline-precompile') ) { diff --git a/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js b/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js index 051de3a18f5..1b18d13b81d 100644 --- a/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +++ b/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -<% if (testType == 'integration') { %>import { describe, it } from 'mocha'; +import { describe, it } from 'mocha'; import { setupComponentTest } from 'ember-mocha'; import hbs from 'htmlbars-inline-precompile'; @@ -24,15 +24,3 @@ describe('<%= friendlyTestName %>', function() { expect(this.$().text().trim()).to.equal('1234'); }); }); -<% } else if (testType == 'unit') { %>import { describe, it } from 'mocha'; -import { <%= camelizedModuleName %> } from '<%= dasherizedPackageName %>/helpers/<%= dasherizedModuleName %>'; - -describe('<%= friendlyTestName %>', function() { - - // TODO: Replace this with your real tests. - it('works', function() { - let result = <%= camelizedModuleName %>(42); - expect(result).to.be.ok; - }); -}); -<% } %> diff --git a/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js b/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js index 89d55cf614c..e8ec73453e2 100644 --- a/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +++ b/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js @@ -1,5 +1,4 @@ import { expect } from 'chai'; -<% if (testType == 'integration') { %> import { describeComponent, it } from 'ember-mocha'; import hbs from 'htmlbars-inline-precompile'; @@ -25,15 +24,3 @@ describeComponent('<%= dasherizedModuleName %>', 'helper:<%= dasherizedModuleNam }); } ); -<% } else if (testType == 'unit') { %>import { describe, it } from 'mocha'; -import { <%= camelizedModuleName %> } from '<%= dasherizedPackageName %>/helpers/<%= dasherizedModuleName %>'; - -describe('<%= friendlyTestName %>', function() { - - // TODO: Replace this with your real tests. - it('works', function() { - let result = <%= camelizedModuleName %>(42); - expect(result).to.be.ok; - }); -}); -<% } %> diff --git a/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js b/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js index 9b6702f1fd8..e41eec5e35c 100644 --- a/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +++ b/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -<% if (testType == 'integration') { %>import { describe, it } from 'mocha'; +import { describe, it } from 'mocha'; import { setupRenderingTest } from 'ember-mocha'; import { render } from '@ember/test-helpers'; <%= hbsImportStatement %> @@ -15,14 +15,4 @@ describe('<%= friendlyTestName %>', function() { expect(this.element.textContent.trim()).to.equal('1234'); }); -});<% } else if (testType == 'unit') { %>import { describe, it } from 'mocha'; -import { <%= camelizedModuleName %> } from '<%= dasherizedPackageName %>/helpers/<%= dasherizedModuleName %>'; - -describe('<%= friendlyTestName %>', function() { - - // TODO: Replace this with your real tests. - it('works', function() { - let result = <%= camelizedModuleName %>(42); - expect(result).to.be.ok; - }); -});<% } %> +}); diff --git a/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js b/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js index 6bef509e111..ff0be722ff7 100644 --- a/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +++ b/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js @@ -1,4 +1,4 @@ -<% if (testType == 'integration') { %>import { moduleForComponent, test } from 'ember-qunit'; +import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent('<%= dasherizedModuleName %>', 'helper:<%= dasherizedModuleName %>', { @@ -12,15 +12,4 @@ test('it renders', function(assert) { this.render(hbs`{{<%= dasherizedModuleName %> this.inputValue}}`); assert.equal(this.$().text().trim(), '1234'); -});<% } else if (testType == 'unit') { %> -import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>'; -import { module, test } from 'qunit'; - -module('<%= friendlyTestName %>'); - -// TODO: Replace this with your real tests. -test('it works', function(assert) { - let result = <%= camelizedModuleName %>([42]); - assert.ok(result); }); -<% } %> diff --git a/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js b/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js index baf3d449ad1..a56c181516e 100644 --- a/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +++ b/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js @@ -1,4 +1,4 @@ -<% if (testType === 'integration') { %>import { module, test } from 'qunit'; +import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; <%= hbsImportStatement %> @@ -14,16 +14,4 @@ module('<%= friendlyTestName %>', function(hooks) { assert.dom(this.element).hasText('1234'); }); -});<% } else if (testType === 'unit') { %>import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>'; -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('<%= friendlyTestName %>', function(hooks) { - setupTest(hooks); - - // TODO: Replace this with your real tests. - test('it works', function(assert) { - let result = <%= camelizedModuleName %>([42]); - assert.ok(result); - }); -});<% } %> +}); diff --git a/node-tests/blueprints/helper-test-test.js b/node-tests/blueprints/helper-test-test.js index 96adcb7747c..2d9004dd9c5 100644 --- a/node-tests/blueprints/helper-test-test.js +++ b/node-tests/blueprints/helper-test-test.js @@ -37,8 +37,8 @@ describe('Blueprint: helper-test', function () { }); }); - it('helper-test foo/bar-baz --integration', function () { - return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], (_file) => { + it('helper-test foo/bar-baz', function () { + return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], (_file) => { expect(_file('tests/integration/helpers/foo/bar-baz-test.js')).to.equal( fixture('helper-test/integration.js') ); @@ -62,14 +62,6 @@ describe('Blueprint: helper-test', function () { ); }); }); - - it('helper-test foo/bar-baz --unit', function () { - return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--unit'], (_file) => { - expect(_file('tests/unit/helpers/foo/bar-baz-test.js')).to.equal( - fixture('helper-test/rfc232-unit.js') - ); - }); - }); }); describe('with ember-cli-mocha@0.11.0', function () { @@ -81,21 +73,13 @@ describe('Blueprint: helper-test', function () { generateFakePackageManifest('ember-cli-mocha', '0.11.0'); }); - it('helper-test foo/bar-baz --integration', function () { + it('helper-test foo/bar-baz', function () { return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], (_file) => { expect(_file('tests/integration/helpers/foo/bar-baz-test.js')).to.equal( fixture('helper-test/mocha.js') ); }); }); - - it('helper-test foo/bar-baz --unit', function () { - return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--unit'], (_file) => { - expect(_file('tests/unit/helpers/foo/bar-baz-test.js')).to.equal( - fixture('helper-test/mocha-unit.js') - ); - }); - }); }); describe('with ember-cli-mocha@0.12.0', function () { @@ -114,14 +98,6 @@ describe('Blueprint: helper-test', function () { ); }); }); - - it('helper-test foo/bar-baz for mocha --unit', function () { - return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--unit'], (_file) => { - expect(_file('tests/unit/helpers/foo/bar-baz-test.js')).to.equal( - fixture('helper-test/mocha-0.12-unit.js') - ); - }); - }); }); describe('with ember-mocha@0.14.0', function () { @@ -140,14 +116,6 @@ describe('Blueprint: helper-test', function () { ); }); }); - - it('helper-test foo/bar-baz for mocha --unit', function () { - return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--unit'], (_file) => { - expect(_file('tests/unit/helpers/foo/bar-baz-test.js')).to.equal( - fixture('helper-test/mocha-rfc232-unit.js') - ); - }); - }); }); }); diff --git a/node-tests/blueprints/helper-test.js b/node-tests/blueprints/helper-test.js index dfecf47ddb7..165687c2827 100644 --- a/node-tests/blueprints/helper-test.js +++ b/node-tests/blueprints/helper-test.js @@ -48,15 +48,6 @@ describe('Blueprint: helper', function () { }); }); - it('helper foo/bar-baz unit', function () { - return emberGenerateDestroy(['helper', '--test-type=unit', 'foo/bar-baz'], (_file) => { - expect(_file('app/helpers/foo/bar-baz.js')).to.equal(fixture('helper/helper.js')); - expect(_file('tests/unit/helpers/foo/bar-baz-test.js')).to.equal( - fixture('helper-test/unit.js') - ); - }); - }); - it('helper foo/bar-baz --pod', function () { return emberGenerateDestroy(['helper', 'foo/bar-baz', '--pod'], (_file) => { expect(_file('app/helpers/foo/bar-baz.js')).to.equal(fixture('helper/helper.js')); diff --git a/node-tests/fixtures/helper-test/mocha-0.12-unit.js b/node-tests/fixtures/helper-test/mocha-0.12-unit.js deleted file mode 100644 index bcce8c2c865..00000000000 --- a/node-tests/fixtures/helper-test/mocha-0.12-unit.js +++ /dev/null @@ -1,13 +0,0 @@ -import { expect } from 'chai'; -import { describe, it } from 'mocha'; -import { fooBarBaz } from 'my-app/helpers/foo/bar-baz'; - -describe('Unit | Helper | foo/bar-baz', function() { - - // TODO: Replace this with your real tests. - it('works', function() { - let result = fooBarBaz(42); - expect(result).to.be.ok; - }); -}); - diff --git a/node-tests/fixtures/helper-test/mocha-0.12.js b/node-tests/fixtures/helper-test/mocha-0.12.js index b78ee50dc92..7c6f1b33dad 100644 --- a/node-tests/fixtures/helper-test/mocha-0.12.js +++ b/node-tests/fixtures/helper-test/mocha-0.12.js @@ -24,4 +24,3 @@ describe('Integration | Helper | foo/bar-baz', function() { expect(this.$().text().trim()).to.equal('1234'); }); }); - diff --git a/node-tests/fixtures/helper-test/mocha-rfc232-unit.js b/node-tests/fixtures/helper-test/mocha-rfc232-unit.js deleted file mode 100644 index f19b35a93f7..00000000000 --- a/node-tests/fixtures/helper-test/mocha-rfc232-unit.js +++ /dev/null @@ -1,12 +0,0 @@ -import { expect } from 'chai'; -import { describe, it } from 'mocha'; -import { fooBarBaz } from 'my-app/helpers/foo/bar-baz'; - -describe('Unit | Helper | foo/bar-baz', function() { - - // TODO: Replace this with your real tests. - it('works', function() { - let result = fooBarBaz(42); - expect(result).to.be.ok; - }); -}); diff --git a/node-tests/fixtures/helper-test/mocha-unit.js b/node-tests/fixtures/helper-test/mocha-unit.js deleted file mode 100644 index bcce8c2c865..00000000000 --- a/node-tests/fixtures/helper-test/mocha-unit.js +++ /dev/null @@ -1,13 +0,0 @@ -import { expect } from 'chai'; -import { describe, it } from 'mocha'; -import { fooBarBaz } from 'my-app/helpers/foo/bar-baz'; - -describe('Unit | Helper | foo/bar-baz', function() { - - // TODO: Replace this with your real tests. - it('works', function() { - let result = fooBarBaz(42); - expect(result).to.be.ok; - }); -}); - diff --git a/node-tests/fixtures/helper-test/mocha.js b/node-tests/fixtures/helper-test/mocha.js index 9e3c985f0e6..37544b7c641 100644 --- a/node-tests/fixtures/helper-test/mocha.js +++ b/node-tests/fixtures/helper-test/mocha.js @@ -1,5 +1,4 @@ import { expect } from 'chai'; - import { describeComponent, it } from 'ember-mocha'; import hbs from 'htmlbars-inline-precompile'; @@ -25,4 +24,3 @@ describeComponent('foo/bar-baz', 'helper:foo/bar-baz', }); } ); - diff --git a/node-tests/fixtures/helper-test/module-unification/addon-unit.js b/node-tests/fixtures/helper-test/module-unification/addon-unit.js deleted file mode 100644 index d38c3e2629c..00000000000 --- a/node-tests/fixtures/helper-test/module-unification/addon-unit.js +++ /dev/null @@ -1,12 +0,0 @@ - -import { fooBarBaz } from 'my-addon/helpers/foo/bar-baz'; -import { module, test } from 'qunit'; - -module('Unit | Helper | foo/bar-baz'); - -// TODO: Replace this with your real tests. -test('it works', function(assert) { - let result = fooBarBaz([42]); - assert.ok(result); -}); - diff --git a/node-tests/fixtures/helper-test/rfc232-unit.js b/node-tests/fixtures/helper-test/rfc232-unit.js deleted file mode 100644 index fc08ea09909..00000000000 --- a/node-tests/fixtures/helper-test/rfc232-unit.js +++ /dev/null @@ -1,13 +0,0 @@ -import { fooBarBaz } from 'my-app/helpers/foo/bar-baz'; -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Helper | foo/bar-baz', function(hooks) { - setupTest(hooks); - - // TODO: Replace this with your real tests. - test('it works', function(assert) { - let result = fooBarBaz([42]); - assert.ok(result); - }); -}); diff --git a/node-tests/fixtures/helper-test/unit.js b/node-tests/fixtures/helper-test/unit.js deleted file mode 100644 index 21a56367d22..00000000000 --- a/node-tests/fixtures/helper-test/unit.js +++ /dev/null @@ -1,12 +0,0 @@ - -import { fooBarBaz } from 'my-app/helpers/foo/bar-baz'; -import { module, test } from 'qunit'; - -module('Unit | Helper | foo/bar-baz'); - -// TODO: Replace this with your real tests. -test('it works', function(assert) { - let result = fooBarBaz([42]); - assert.ok(result); -}); -