Skip to content

Commit

Permalink
add model mocha rfc 232 blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaulagiri committed Oct 3, 2018
1 parent dff6d10 commit 7cd89cf
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';

describe('<%= friendlyTestDescription %>', function() {
setupTest();

// Replace this with your real tests.
it('exists', function() {
let store = this.owner.lookup('service:store');
let model = store.createRecord('<%= dasherizedModuleName %>', {});
expect(model).to.be.ok;
});
});
44 changes: 44 additions & 0 deletions node-tests/blueprints/model-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,26 @@ describe('Acceptance: generate and destroy model blueprints', function() {
});
});
});

describe('with ember-mocha v0.14+', function() {
beforeEach(function() {
modifyPackages([
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-mocha', dev: true },
]);
generateFakePackageManifest('ember-mocha', '0.14.0');
});

it('model-test for mocha v0.14+', function() {
let args = ['model-test', 'foo'];

return emberGenerateDestroy(args, _file => {
expect(_file('tests/unit/models/foo-test.js')).to.equal(
fixture('model-test/mocha-rfc232.js')
);
});
});
});
});

describe('module unification', function() {
Expand Down Expand Up @@ -297,5 +317,29 @@ describe('Acceptance: generate and destroy model blueprints', function() {
);
});
});

describe('with ember-mocha v0.14+', function() {
beforeEach(function() {
modifyPackages([
{ name: 'ember-cli-qunit', delete: true },
{ name: 'ember-mocha', dev: true },
]);
generateFakePackageManifest('ember-mocha', '0.14.0');
});

it('model-test for mocha v0.14+', function() {
let args = ['model-test', 'foo'];

return emberGenerateDestroy(
args,
_file => {
expect(_file('src/data/models/foo/model-test.js')).to.equal(
fixture('model-test/mocha-rfc232.js')
);
},
{ isModuleUnification: true }
);
});
});
});
});
14 changes: 14 additions & 0 deletions node-tests/fixtures/model-test/mocha-rfc232.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';

describe('Unit | Model | foo', function() {
setupTest();

// Replace this with your real tests.
it('exists', function() {
let store = this.owner.lookup('service:store');
let model = store.createRecord('foo', {});
expect(model).to.be.ok;
});
});

0 comments on commit 7cd89cf

Please sign in to comment.