Skip to content

Commit

Permalink
add remaining mocha rfc 232 blueprints (#5665)
Browse files Browse the repository at this point in the history
* add mocha rfc232 serializer tests

* add MU adapter test

* add model mocha rfc 232 blueprints

* add transform mocha rfc 232 blueprints
  • Loading branch information
Dhaulagiri authored and runspired committed Oct 4, 2018
1 parent 9112790 commit 6252353
Show file tree
Hide file tree
Showing 10 changed files with 258 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;
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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 serializer = store.serializerFor('<%= dasherizedModuleName %>');

expect(serializer).to.be.ok;
});

it('serializes records', function() {
let store = this.owner.lookup('service:store');
let record = store.createRecord('<%= dasherizedModuleName %>', {});

let serializedRecord = record.serialize();

expect(serializedRecord).to.be.ok;
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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 transform = this.owner.lookup('transform:<%= dasherizedModuleName %>');
expect(transform).to.be.ok;
});
});
24 changes: 24 additions & 0 deletions node-tests/blueprints/adapter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,5 +287,29 @@ describe('Acceptance: generate and destroy adapter 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('adapter-test for mocha v0.14+', function() {
let args = ['adapter-test', 'foo'];

return emberGenerateDestroy(
args,
_file => {
expect(_file('src/data/models/foo/adapter-test.js')).to.equal(
fixture('adapter-test/mocha-rfc232.js')
);
},
{ isModuleUnification: true }
);
});
});
});
});
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 }
);
});
});
});
});
44 changes: 44 additions & 0 deletions node-tests/blueprints/serializer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,26 @@ describe('Acceptance: generate and destroy serializer 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('serializer-test for mocha v0.14+', function() {
let args = ['serializer-test', 'foo'];

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

describe('module unification', function() {
Expand Down Expand Up @@ -278,5 +298,29 @@ describe('Acceptance: generate and destroy serializer 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('serializer-test for mocha v0.14+', function() {
let args = ['serializer-test', 'foo'];

return emberGenerateDestroy(
args,
_file => {
expect(_file('src/data/models/foo/serializer-test.js')).to.equal(
fixture('serializer-test/mocha-rfc232.js')
);
},
{ isModuleUnification: true }
);
});
});
});
});
44 changes: 44 additions & 0 deletions node-tests/blueprints/transform-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@ describe('Acceptance: generate and destroy transform 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('transform-test for mocha v0.14+', function() {
let args = ['transform-test', 'foo'];

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

Expand Down Expand Up @@ -164,6 +184,30 @@ describe('Acceptance: generate and destroy transform 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('transform-test for mocha v0.14+', function() {
let args = ['transform-test', 'foo'];

return emberGenerateDestroy(
args,
_file => {
expect(_file('src/data/transforms/foo-test.js')).to.equal(
fixture('transform-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;
});
});
24 changes: 24 additions & 0 deletions node-tests/fixtures/serializer-test/mocha-rfc232.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';

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

// Replace this with your real tests.
it('exists', function() {
let store = this.owner.lookup('service:store');
let serializer = store.serializerFor('foo');

expect(serializer).to.be.ok;
});

it('serializes records', function() {
let store = this.owner.lookup('service:store');
let record = store.createRecord('foo', {});

let serializedRecord = record.serialize();

expect(serializedRecord).to.be.ok;
});
});
13 changes: 13 additions & 0 deletions node-tests/fixtures/transform-test/mocha-rfc232.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';

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

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

0 comments on commit 6252353

Please sign in to comment.