Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/blueprints: Use fixture files #15941

Merged
merged 10 commits into from
Dec 7, 2017
33 changes: 6 additions & 27 deletions node-tests/blueprints/component-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo', function() {
return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
expect(_file('tests/integration/components/x-foo/component-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
.to.contain("{{x-foo}}")
.to.contain("{{#x-foo}}");
.to.equal(fixture('component-test/default.js'));
});
});
});
Expand Down Expand Up @@ -134,12 +129,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo', function() {
return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
.to.contain("{{x-foo}}")
.to.contain("{{#x-foo}}");
.to.equal(fixture('component-test/default.js'));

expect(_file('app/component-test/x-foo.js'))
.to.not.exist;
Expand All @@ -149,9 +139,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo --unit', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--unit'], _file => {
expect(_file('tests/unit/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("unit: true");
.to.equal(fixture('component-test/unit.js'));

expect(_file('app/component-test/x-foo.js'))
.to.not.exist;
Expand All @@ -161,9 +149,7 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo --dummy', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--dummy'], _file => {
expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('x-foo'");
.to.equal(fixture('component-test/default.js'));

expect(_file('app/component-test/x-foo.js'))
.to.not.exist;
Expand All @@ -179,21 +165,14 @@ describe('Blueprint: component-test', function() {
it('component-test x-foo --in-repo-addon=my-addon', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon'], _file => {
expect(_file('tests/integration/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("integration: true")
.to.contain("{{x-foo}}")
.to.contain("{{#x-foo}}");
.to.equal(fixture('component-test/default.js'));
});
});

it('component-test x-foo --in-repo-addon=my-addon --unit', function() {
return emberGenerateDestroy(['component-test', 'x-foo', '--in-repo-addon=my-addon', '--unit'], _file => {
expect(_file('tests/unit/components/x-foo-test.js'))
.to.contain("import { moduleForComponent, test } from 'ember-qunit';")
.to.contain("moduleForComponent('x-foo'")
.to.contain("unit: true");
.to.equal(fixture('component-test/unit.js'));
});
});
});
Expand Down
15 changes: 5 additions & 10 deletions node-tests/blueprints/controller-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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: controller-test', function() {
setupTestHooks(this);
Expand All @@ -22,8 +23,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo'");
.to.equal(fixture('controller-test/default.js'));
});
});

Expand All @@ -39,8 +39,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo for mocha', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
.to.contain("import { describeModule, it } from 'ember-mocha';")
.to.contain("describeModule('controller:foo', 'Unit | Controller | foo'");
.to.equal(fixture('controller-test/mocha.js'));
});
});
});
Expand All @@ -57,10 +56,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
.to.contain("import { describe, it } from 'mocha';")
.to.contain("import { setupTest } from 'ember-mocha';")
.to.contain("describe('Unit | Controller | foo'")
.to.contain("setupTest('controller:foo',");
.to.equal(fixture('controller-test/mocha-0.12.js'));
});
});
});
Expand All @@ -74,8 +70,7 @@ describe('Blueprint: controller-test', function() {
it('controller-test foo', function() {
return emberGenerateDestroy(['controller-test', 'foo'], _file => {
expect(_file('tests/unit/controllers/foo-test.js'))
.to.contain("import { moduleFor, test } from 'ember-qunit';")
.to.contain("moduleFor('controller:foo'");
.to.equal(fixture('controller-test/default.js'));
});
});
});
Expand Down
12 changes: 3 additions & 9 deletions node-tests/blueprints/helper-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ describe('Blueprint: helper-test', function() {
it('helper-test foo/bar-baz --integration', function() {
return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.contain("import { describeComponent, it } from 'ember-mocha';")
.to.contain("import hbs from 'htmlbars-inline-precompile';");
.to.equal(fixture('helper-test/mocha.js'));
});
});
});
Expand All @@ -64,19 +63,14 @@ describe('Blueprint: helper-test', function() {
it('helper-test foo/bar-baz --integration', function() {
return emberGenerateDestroy(['helper-test', 'foo/bar-baz', '--integration'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.contain("import { describe, it } from 'mocha';")
.to.contain("import { setupComponentTest } from 'ember-mocha';")
.to.contain("import hbs from 'htmlbars-inline-precompile';")
.to.contain("describe('Integration | Helper | foo/bar baz', function() {");
.to.equal(fixture('helper-test/mocha-0.12.js'));
});
});

it('helper-test foo/bar-baz for mocha', function() {
return emberGenerateDestroy(['helper-test', 'foo/bar-baz'], _file => {
expect(_file('tests/integration/helpers/foo/bar-baz-test.js'))
.to.contain("import { describe, it } from 'mocha';")
.to.contain("setupComponentTest('foo/bar-baz', {")
.to.contain("describe('Integration | Helper | foo/bar baz', function() {");
.to.equal(fixture('helper-test/mocha-0.12.js'));
});
});
});
Expand Down
17 changes: 5 additions & 12 deletions node-tests/blueprints/initializer-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;

const fixture = require('../helpers/fixture');

describe('Blueprint: initializer-test', function() {
setupTestHooks(this);

Expand All @@ -20,10 +22,7 @@ describe('Blueprint: initializer-test', function() {
it('initializer-test foo', function() {
return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.contain("import { initialize } from 'my-app/initializers/foo';")
.to.contain("module('Unit | Initializer | foo'")
.to.contain("application = Application.create();")
.to.contain("initialize(this.application);");
.to.equal(fixture('initializer-test/default.js'));
});
});

Expand All @@ -38,10 +37,7 @@ describe('Blueprint: initializer-test', function() {
it('initializer-test foo', function() {
return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.contain("import { initialize } from 'my-app/initializers/foo';")
.to.contain("describe('Unit | Initializer | foo', function() {")
.to.contain("application = Application.create();")
.to.contain("initialize(application);");
.to.equal(fixture('initializer-test/mocha.js'));
});
});
});
Expand All @@ -55,10 +51,7 @@ describe('Blueprint: initializer-test', function() {
it('initializer-test foo', function() {
return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.contain("import { initialize } from 'dummy/initializers/foo';")
.to.contain("module('Unit | Initializer | foo'")
.to.contain("application = Application.create();")
.to.contain("initialize(this.application);");
.to.equal(fixture('initializer-test/dummy.js'));
});
});
});
Expand Down
20 changes: 5 additions & 15 deletions node-tests/blueprints/instance-initializer-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;

const fixture = require('../helpers/fixture');

describe('Blueprint: instance-initializer-test', function() {
setupTestHooks(this);

Expand All @@ -20,11 +22,7 @@ describe('Blueprint: instance-initializer-test', function() {
it('instance-initializer-test foo', function() {
return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
.to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
.to.contain("module('Unit | Instance Initializer | foo'")
.to.contain("application = Application.create();")
.to.contain("this.appInstance = this.application.buildInstance();")
.to.contain("initialize(this.appInstance);");
.to.equal(fixture('instance-initializer-test/default.js'));
});
});

Expand All @@ -39,11 +37,7 @@ describe('Blueprint: instance-initializer-test', function() {
it('instance-initializer-test foo for mocha', function() {
return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
.to.contain("import { initialize } from 'my-app/instance-initializers/foo';")
.to.contain("describe('Unit | Instance Initializer | foo', function() {")
.to.contain("application = Application.create();")
.to.contain("appInstance = application.buildInstance();")
.to.contain("initialize(appInstance);");
.to.equal(fixture('instance-initializer-test/mocha.js'));
});
});
});
Expand All @@ -57,11 +51,7 @@ describe('Blueprint: instance-initializer-test', function() {
it('instance-initializer-test foo', function() {
return emberGenerateDestroy(['instance-initializer-test', 'foo'], _file => {
expect(_file('tests/unit/instance-initializers/foo-test.js'))
.to.contain("import { initialize } from 'dummy/instance-initializers/foo';")
.to.contain("module('Unit | Instance Initializer | foo'")
.to.contain("application = Application.create();")
.to.contain("this.appInstance = this.application.buildInstance();")
.to.contain("initialize(this.appInstance);");
.to.equal(fixture('instance-initializer-test/dummy.js'));
});
});
});
Expand Down
10 changes: 5 additions & 5 deletions node-tests/blueprints/mixin-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;

const fixture = require('../helpers/fixture');

describe('Blueprint: mixin-test', function() {
setupTestHooks(this);

Expand All @@ -20,7 +22,7 @@ describe('Blueprint: mixin-test', function() {
it('mixin-test foo', function() {
return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
expect(_file('tests/unit/mixins/foo-test.js'))
.to.contain("import FooMixin from 'my-app/mixins/foo';");
.to.equal(fixture('mixin-test/default.js'));
});
});

Expand All @@ -35,9 +37,7 @@ describe('Blueprint: mixin-test', function() {
it('mixin-test foo', function() {
return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
expect(_file('tests/unit/mixins/foo-test.js'))
.to.contain("import { describe, it } from 'mocha';")
.to.contain("import FooMixin from 'my-app/mixins/foo';")
.to.contain("describe('Unit | Mixin | foo', function() {");
.to.equal(fixture('mixin-test/mocha.js'));
});
});
});
Expand All @@ -51,7 +51,7 @@ describe('Blueprint: mixin-test', function() {
it('mixin-test foo', function() {
return emberGenerateDestroy(['mixin-test', 'foo'], _file => {
expect(_file('tests/unit/mixins/foo-test.js'))
.to.contain("import FooMixin from 'my-addon/mixins/foo';");
.to.equal(fixture('mixin-test/addon.js'));
});
});
});
Expand Down
15 changes: 5 additions & 10 deletions node-tests/blueprints/route-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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: route-test', function() {
setupTestHooks(this);
Expand All @@ -22,8 +23,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
.to.contain('import { moduleFor, test } from \'ember-qunit\';')
.to.contain('moduleFor(\'route:foo\'');
.to.equal(fixture('route-test/default.js'));
});
});

Expand All @@ -39,8 +39,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
.to.contain('import { describeModule, it } from \'ember-mocha\';')
.to.contain('describeModule(\'route:foo\', \'Unit | Route | foo\'');
.to.equal(fixture('route-test/mocha.js'));
});
});
});
Expand All @@ -57,10 +56,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
.to.contain('import { describe, it } from \'mocha\';')
.to.contain('import { setupTest } from \'ember-mocha\';')
.to.contain('describe(\'Unit | Route | foo\', function() {')
.to.contain('setupTest(\'route:foo\',');
.to.equal(fixture('route-test/mocha-0.12.js'));
});
});
});
Expand All @@ -74,8 +70,7 @@ describe('Blueprint: route-test', function() {
it('route-test foo', function() {
return emberGenerateDestroy(['route-test', 'foo'], (_file) => {
expect(_file('tests/unit/routes/foo-test.js'))
.to.contain('import { moduleFor, test } from \'ember-qunit\';')
.to.contain('moduleFor(\'route:foo\'');
.to.equal(fixture('route-test/default.js'));
});
});
});
Expand Down
Loading