From 9063cf8ecf66ea8e60cc5331ca281caa44fa8caa Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 2 Mar 2020 12:45:42 -0500 Subject: [PATCH] ui: Updates Consul blueprints to be compatible with new ED version (#7370) --- ui-v2/blueprints/adapter-test/index.js | 11 +++++------ ui-v2/blueprints/adapter/index.js | 14 -------------- ui-v2/blueprints/model-test/index.js | 10 ++++------ ui-v2/blueprints/model/index.js | 16 ---------------- ui-v2/blueprints/repository-test/index.js | 10 ++++------ .../integration/services/repository/__test__.js | 2 +- .../unit/services/repository/__test__.js | 2 +- ui-v2/blueprints/serializer-test/index.js | 10 ++++------ ui-v2/blueprints/serializer/index.js | 14 -------------- 9 files changed, 19 insertions(+), 70 deletions(-) diff --git a/ui-v2/blueprints/adapter-test/index.js b/ui-v2/blueprints/adapter-test/index.js index 8da2979c1..db9261ce1 100644 --- a/ui-v2/blueprints/adapter-test/index.js +++ b/ui-v2/blueprints/adapter-test/index.js @@ -1,11 +1,10 @@ -/*eslint node/no-extraneous-require: "off"*/ -'use strict'; - -const useTestFrameworkDetector = require('@ember-data/-build-infra/src/utilities/test-framework-detector'); const path = require('path'); +const testInfo = require('ember-cli-test-info'); +const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector'); + module.exports = useTestFrameworkDetector({ - description: 'Generates a Consul HTTP ember-data adapter unit and integration tests', + description: 'Generates Consul HTTP ember-data adapter unit and integration tests', root: __dirname, @@ -16,7 +15,7 @@ module.exports = useTestFrameworkDetector({ }, __path__() { return ''; - } + }, }; }, diff --git a/ui-v2/blueprints/adapter/index.js b/ui-v2/blueprints/adapter/index.js index dce3adcb4..e718c544f 100644 --- a/ui-v2/blueprints/adapter/index.js +++ b/ui-v2/blueprints/adapter/index.js @@ -2,7 +2,6 @@ 'use strict'; const path = require('path'); -const isModuleUnificationProject = require('@ember-data/-build-infra/src/utilities/module-unification').isModuleUnificationProject; module.exports = { description: 'Generates a Consul HTTP ember-data adapter', @@ -11,19 +10,6 @@ module.exports = { root: __dirname, fileMapTokens(options) { - if (isModuleUnificationProject(this.project)) { - return { - __root__() { - return 'src'; - }, - __path__(options) { - return path.join('data', 'models', options.dasherizedModuleName); - }, - __name__() { - return 'adapter'; - }, - }; - } }, locals(options) { // Return custom template variables here. diff --git a/ui-v2/blueprints/model-test/index.js b/ui-v2/blueprints/model-test/index.js index bc1a43b6c..df90b56ee 100644 --- a/ui-v2/blueprints/model-test/index.js +++ b/ui-v2/blueprints/model-test/index.js @@ -1,11 +1,9 @@ -/*eslint node/no-extraneous-require: "off"*/ -'use strict'; - -const useTestFrameworkDetector = require('@ember-data/-build-infra/src/utilities/test-framework-detector'); const path = require('path'); +const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector'); + module.exports = useTestFrameworkDetector({ - description: 'Generates a Consul ember-data model unit tests', + description: 'Generates a Consul ember-data model unit test.', root: __dirname, @@ -16,7 +14,7 @@ module.exports = useTestFrameworkDetector({ }, __path__() { return ''; - } + }, }; }, diff --git a/ui-v2/blueprints/model/index.js b/ui-v2/blueprints/model/index.js index d41b1db1f..f57d80179 100644 --- a/ui-v2/blueprints/model/index.js +++ b/ui-v2/blueprints/model/index.js @@ -2,7 +2,6 @@ 'use strict'; const path = require('path'); -const isModuleUnificationProject = require('@ember-data/-build-infra/src/utilities/module-unification').isModuleUnificationProject; module.exports = { description: 'Generates a Consul HTTP ember-data model', @@ -10,21 +9,6 @@ module.exports = { root: __dirname, - fileMapTokens(options) { - if (isModuleUnificationProject(this.project)) { - return { - __root__() { - return 'src'; - }, - __path__(options) { - return path.join('data', 'models', options.dasherizedModuleName); - }, - __name__() { - return 'model'; - }, - }; - } - }, locals(options) { // Return custom template variables here. return { diff --git a/ui-v2/blueprints/repository-test/index.js b/ui-v2/blueprints/repository-test/index.js index 1c201dc10..608090ed1 100644 --- a/ui-v2/blueprints/repository-test/index.js +++ b/ui-v2/blueprints/repository-test/index.js @@ -1,11 +1,9 @@ -/*eslint node/no-extraneous-require: "off"*/ -'use strict'; - -const useTestFrameworkDetector = require('@ember-data/-build-infra/src/utilities/test-framework-detector'); const path = require('path'); +const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector'); + module.exports = useTestFrameworkDetector({ - description: 'Generates a Consul HTTP ember-data serializer unit and integration tests', + description: 'Generates Consul repository unit and integration tests', root: __dirname, @@ -16,7 +14,7 @@ module.exports = useTestFrameworkDetector({ }, __path__() { return ''; - } + }, }; }, diff --git a/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/integration/services/repository/__test__.js b/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/integration/services/repository/__test__.js index 630f4b8ad..e2dbc803e 100644 --- a/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/integration/services/repository/__test__.js +++ b/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/integration/services/repository/__test__.js @@ -9,7 +9,7 @@ const dc = 'dc-1'; const id = 'slug'; const now = new Date().getTime(); test('findByDatacenter returns the correct data for list endpoint', function(assert) { - get(this.subject(), 'store').serializerFor('<%= dasherizedModuleName %>').timestamp = function() { + this.subject().store.serializerFor('<%= dasherizedModuleName %>').timestamp = function() { return now; }; return repo( diff --git a/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/unit/services/repository/__test__.js b/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/unit/services/repository/__test__.js index d550fcfd7..ff5dad85a 100644 --- a/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/unit/services/repository/__test__.js +++ b/ui-v2/blueprints/repository-test/qunit-files/__root__/__path__/unit/services/repository/__test__.js @@ -6,7 +6,7 @@ module('Unit | Repository | <%= dasherizedModuleName %>', function(hooks) { // Replace this with your real tests. test('it exists', function(assert) { - let repo = this.owner.lookup('service:repository/<%= dasherizedModuleName %>'); + const repo = this.owner.lookup('service:repository/<%= dasherizedModuleName %>'); assert.ok(repo); }); }); diff --git a/ui-v2/blueprints/serializer-test/index.js b/ui-v2/blueprints/serializer-test/index.js index 33a1a3620..99f321a20 100644 --- a/ui-v2/blueprints/serializer-test/index.js +++ b/ui-v2/blueprints/serializer-test/index.js @@ -1,11 +1,9 @@ -/*eslint node/no-extraneous-require: "off"*/ -'use strict'; - -const useTestFrameworkDetector = require('@ember-data/-build-infra/src/utilities/test-framework-detector'); const path = require('path'); +const useTestFrameworkDetector = require('@ember-data/private-build-infra/src/utilities/test-framework-detector'); + module.exports = useTestFrameworkDetector({ - description: 'Generates a Consul HTTP ember-data serializer unit and integration tests', + description: 'Generates Consul HTTP ember-data serializer unit and integration tests.', root: __dirname, @@ -16,7 +14,7 @@ module.exports = useTestFrameworkDetector({ }, __path__() { return ''; - } + }, }; }, diff --git a/ui-v2/blueprints/serializer/index.js b/ui-v2/blueprints/serializer/index.js index 393a3965b..b2c51f152 100644 --- a/ui-v2/blueprints/serializer/index.js +++ b/ui-v2/blueprints/serializer/index.js @@ -2,7 +2,6 @@ 'use strict'; const path = require('path'); -const isModuleUnificationProject = require('@ember-data/-build-infra/src/utilities/module-unification').isModuleUnificationProject; module.exports = { description: 'Generates a Consul HTTP ember-data serializer', @@ -11,19 +10,6 @@ module.exports = { root: __dirname, fileMapTokens(options) { - if (isModuleUnificationProject(this.project)) { - return { - __root__() { - return 'src'; - }, - __path__(options) { - return path.join('data', 'models', options.dasherizedModuleName); - }, - __name__() { - return 'serializer'; - }, - }; - } }, locals(options) { // Return custom template variables here.