-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5495 from dcyriller/mu-transform-blueprint
[Feature] Add MU transform{,-test} blueprints
- Loading branch information
Showing
7 changed files
with
184 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
const isModuleUnificationProject = require('../../lib/utilities/module-unification') | ||
.isModuleUnificationProject; | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
description: 'Generates an ember-data value transform.', | ||
|
||
fileMapTokens(options) { | ||
if (isModuleUnificationProject(this.project)) { | ||
return { | ||
__root__() { | ||
return 'src'; | ||
}, | ||
__path__(options) { | ||
return path.join('data', 'transforms'); | ||
}, | ||
__name__() { | ||
return options.dasherizedModuleName; | ||
}, | ||
}; | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,66 +15,152 @@ const fixture = require('../helpers/fixture'); | |
describe('Acceptance: generate and destroy transform blueprints', function() { | ||
setupTestHooks(this); | ||
|
||
describe('in app', function() { | ||
beforeEach(function() { | ||
return emberNew(); | ||
}); | ||
describe('classic', function() { | ||
describe('in app', function() { | ||
beforeEach(function() { | ||
return emberNew(); | ||
}); | ||
|
||
it('transform', function() { | ||
let args = ['transform', 'foo']; | ||
it('transform', function() { | ||
let args = ['transform', 'foo']; | ||
|
||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('app/transforms/foo.js')) | ||
.to.contain("import DS from 'ember-data';") | ||
.to.contain('export default DS.Transform.extend(') | ||
.to.contain('deserialize(serialized) {') | ||
.to.contain('serialize(deserialized) {'); | ||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('app/transforms/foo.js')) | ||
.to.contain("import DS from 'ember-data';") | ||
.to.contain('export default DS.Transform.extend(') | ||
.to.contain('deserialize(serialized) {') | ||
.to.contain('serialize(deserialized) {'); | ||
|
||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/default.js') | ||
); | ||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/default.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
it('transform-test', function() { | ||
let args = ['transform-test', 'foo']; | ||
it('transform-test', function() { | ||
let args = ['transform-test', 'foo']; | ||
|
||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/default.js') | ||
); | ||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/default.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('transform-test with [email protected]', function() { | ||
beforeEach(function() { | ||
generateFakePackageManifest('ember-cli-qunit', '4.2.0'); | ||
describe('transform-test with [email protected]', function() { | ||
beforeEach(function() { | ||
generateFakePackageManifest('ember-cli-qunit', '4.2.0'); | ||
}); | ||
|
||
it('transform-test-test foo', function() { | ||
return emberGenerateDestroy(['transform-test', 'foo'], _file => { | ||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/rfc232.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
it('transform-test-test foo', function() { | ||
return emberGenerateDestroy(['transform-test', 'foo'], _file => { | ||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/rfc232.js') | ||
); | ||
describe('with ember-cli-mocha v0.12+', function() { | ||
beforeEach(function() { | ||
modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true }, | ||
]); | ||
generateFakePackageManifest('ember-cli-mocha', '0.12.0'); | ||
}); | ||
|
||
it('transform-test for mocha v0.12+', function() { | ||
let args = ['transform-test', 'foo']; | ||
|
||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/mocha-0.12.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('with ember-cli-mocha v0.12+', function() { | ||
describe('module unification', function() { | ||
describe('in app', function() { | ||
beforeEach(function() { | ||
modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true }, | ||
]); | ||
generateFakePackageManifest('ember-cli-mocha', '0.12.0'); | ||
return emberNew({ isModuleUnification: true }); | ||
}); | ||
|
||
it('transform-test for mocha v0.12+', function() { | ||
it('transform', function() { | ||
let args = ['transform', 'foo']; | ||
|
||
return emberGenerateDestroy( | ||
args, | ||
_file => { | ||
expect(_file('src/data/transforms/foo.js')) | ||
.to.contain("import DS from 'ember-data';") | ||
.to.contain('export default DS.Transform.extend(') | ||
.to.contain('deserialize(serialized) {') | ||
.to.contain('serialize(deserialized) {'); | ||
|
||
expect(_file('src/data/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/default.js') | ||
); | ||
}, | ||
{ isModuleUnification: true } | ||
); | ||
}); | ||
|
||
it('transform-test', function() { | ||
let args = ['transform-test', 'foo']; | ||
|
||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('tests/unit/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/mocha-0.12.js') | ||
return emberGenerateDestroy( | ||
args, | ||
_file => { | ||
expect(_file('src/data/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/default.js') | ||
); | ||
}, | ||
{ isModuleUnification: true } | ||
); | ||
}); | ||
|
||
describe('transform-test with [email protected]', function() { | ||
beforeEach(function() { | ||
generateFakePackageManifest('ember-cli-qunit', '4.2.0'); | ||
}); | ||
|
||
it('transform-test-test foo', function() { | ||
return emberGenerateDestroy( | ||
['transform-test', 'foo'], | ||
_file => { | ||
expect(_file('src/data/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/rfc232.js') | ||
); | ||
}, | ||
{ isModuleUnification: true } | ||
); | ||
}); | ||
}); | ||
|
||
describe('with ember-cli-mocha v0.12+', function() { | ||
beforeEach(function() { | ||
modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true }, | ||
]); | ||
generateFakePackageManifest('ember-cli-mocha', '0.12.0'); | ||
}); | ||
|
||
it('transform-test for mocha v0.12+', function() { | ||
let args = ['transform-test', 'foo']; | ||
|
||
return emberGenerateDestroy( | ||
args, | ||
_file => { | ||
expect(_file('src/data/transforms/foo-test.js')).to.equal( | ||
fixture('transform-test/mocha-0.12.js') | ||
); | ||
}, | ||
{ isModuleUnification: true } | ||
); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters