Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Commit f565101

Browse files
committed
chore: cleanup all legacy test blueprints support
1 parent 342f2ca commit f565101

File tree

124 files changed

+713
-2265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+713
-2265
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
1-
import { describe, it, beforeEach, afterEach } from 'mocha';
1+
import { describe, it } from 'mocha';
22
import { expect } from 'chai';
3-
import startApp from '<%= dasherizedPackageName %>/tests/helpers/start-app';
4-
<% if (destroyAppExists) { %>import destroyApp from '<%= dasherizedPackageName %>/tests/helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop';<% } %>
3+
import { setupApplicationTest } from 'ember-mocha';
4+
import { visit, currentURL } from '@ember/test-helpers';
55

66
describe('<%= friendlyTestName %>', function() {
7-
let application;
7+
setupApplicationTest();
88

9-
beforeEach(function() {
10-
application = startApp();
11-
});
12-
13-
afterEach(function() {
14-
<% if (destroyAppExists) { %>destroyApp(application);<% } else { %>run(application, 'destroy');<% } %>
15-
});
16-
17-
it('can visit /<%= dasherizedModuleName %>', function() {
18-
visit('/<%= dasherizedModuleName %>');
19-
20-
return andThen(() => {
21-
expect(currentURL()).to.equal('/<%= dasherizedModuleName %>');
22-
});
9+
it('can visit /<%= dasherizedModuleName %>', async function() {
10+
await visit('/<%= dasherizedModuleName %>');
11+
expect(currentURL()).to.equal('/<%= dasherizedModuleName %>');
2312
});
2413
});

blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.ts

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { test } from 'qunit';
2-
import moduleForAcceptance from '<%= testFolderRoot %>/tests/helpers/module-for-acceptance';
1+
import { module, test } from 'qunit';
2+
import { visit, currentURL } from '@ember/test-helpers';
3+
import { setupApplicationTest } from 'ember-qunit';
34

4-
moduleForAcceptance('<%= friendlyTestName %>');
5+
module('<%= friendlyTestName %>', function(hooks) {
6+
setupApplicationTest(hooks);
57

6-
test('visiting /<%= dasherizedModuleName %>', function(assert) {
7-
visit('/<%= dasherizedModuleName %>');
8+
test('visiting /<%= dasherizedModuleName %>', async function(assert) {
9+
await visit('/<%= dasherizedModuleName %>');
810

9-
andThen(function() {
1011
assert.equal(currentURL(), '/<%= dasherizedModuleName %>');
1112
});
1213
});

blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.ts

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { moduleFor, test } from 'ember-qunit';
1+
import { module, test } from 'qunit';
2+
import { setupTest } from 'ember-qunit';
23

3-
moduleFor('adapter:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', {
4-
// Specify the other units that are required for this test.
5-
// needs: ['serializer:foo']
6-
});
4+
module('<%= friendlyTestDescription %>', function(hooks) {
5+
setupTest(hooks);
76

8-
// Replace this with your real tests.
9-
test('it exists', function(assert) {
10-
let adapter = this.subject();
11-
assert.ok(adapter);
7+
// Replace this with your real tests.
8+
test('it exists', function(assert) {
9+
let adapter = this.owner.lookup('adapter:<%= dasherizedModuleName %>');
10+
assert.ok(adapter);
11+
});
1212
});

blueprints/adapter-test/qunit-rfc-232-files/tests/unit/__path__/__test__.ts

-12
This file was deleted.

blueprints/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.ts

-31
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
import { expect } from 'chai';
2-
import { describeComponent, it } from 'ember-mocha';<% if (testType === 'integration') { %>
3-
import hbs from 'htmlbars-inline-precompile';<% } %>
4-
5-
describeComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>',
6-
{
7-
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test
8-
// needs: ['component:foo', 'helper:bar'],
9-
unit: true<% } %>
10-
},
11-
function() {
12-
it('renders', function() {
13-
<% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value');
14-
// Handle any actions with this.on('myAction', function(val) { ... });
15-
// Template block usage:
16-
// this.render(hbs`
17-
// {{#<%= dasherizedModuleName %>}}
18-
// template content
19-
// {{/<%= dasherizedModuleName %>}}
20-
// `);
21-
22-
this.render(hbs`{{<%= dasherizedModuleName %>}}`);
23-
expect(this.$()).to.have.length(1);<% } else if(testType === 'unit') { %>// creates the component instance
24-
let component = this.subject();
25-
// renders the component on the page
26-
this.render();
27-
expect(component).to.be.ok;
28-
expect(this.$()).to.have.length(1);<% } %>
29-
});
30-
}
31-
);
1+
<% if (testType === 'integration') { %>import { expect } from 'chai';
2+
import { describe, it } from 'mocha';
3+
import { setupRenderingTest } from 'ember-mocha';
4+
import { render } from '@ember/test-helpers';
5+
import hbs from 'htmlbars-inline-precompile';
6+
7+
describe('<%= friendlyTestDescription %>', function() {
8+
setupRenderingTest();
9+
10+
it('renders', async function() {
11+
// Set any properties with this.set('myProperty', 'value');
12+
// Handle any actions with this.set('myAction', function(val) { ... });
13+
14+
await render(hbs`{{<%= componentPathName %>}}`);
15+
16+
expect(this.element.textContent.trim()).to.equal('');
17+
18+
// Template block usage:
19+
await render(hbs`
20+
{{#<%= componentPathName %>}}
21+
template block text
22+
{{/<%= componentPathName %>}}
23+
`);
24+
25+
expect(this.element.textContent.trim()).to.equal('template block text');
26+
});
27+
});<% } else if (testType === 'unit') { %>import { expect } from 'chai';
28+
import { describe, it } from 'mocha';
29+
import { setupTest } from 'ember-mocha';
30+
31+
describe('<%= friendlyTestDescription %>', function() {
32+
setupTest();
33+
34+
it('exists', function() {
35+
let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
36+
expect(component).to.be.ok;
37+
});
38+
});<% } %>

blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.ts

-38
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1-
import { moduleForComponent, test } from 'ember-qunit';<% if (testType === 'integration') { %>
2-
import hbs from 'htmlbars-inline-precompile';<% } %>
3-
4-
moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', {
5-
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test
6-
// needs: ['component:foo', 'helper:bar'],
7-
unit: true<% } %>
8-
});
9-
10-
test('it renders', function(assert) {
11-
<% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value');
12-
// Handle any actions with this.on('myAction', function(val) { ... });
13-
14-
this.render(hbs`{{<%= componentPathName %>}}`);
15-
16-
assert.equal(this.$().text().trim(), '');
17-
18-
// Template block usage:
19-
this.render(hbs`
20-
{{#<%= componentPathName %>}}
21-
template block text
22-
{{/<%= componentPathName %>}}
23-
`);
24-
25-
assert.equal(this.$().text().trim(), 'template block text');<% } else if(testType === 'unit') { %>
26-
// Creates the component instance
27-
/*let component =*/ this.subject();
28-
// Renders the component to the page
29-
this.render();
30-
assert.equal(this.$().text().trim(), '');<% } %>
31-
});
1+
<% if (testType === 'integration') { %>import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
3+
import { render } from '@ember/test-helpers';
4+
import hbs from 'htmlbars-inline-precompile';
5+
6+
module('<%= friendlyTestDescription %>', function(hooks) {
7+
setupRenderingTest(hooks);
8+
9+
test('it renders', async function(assert) {
10+
// Set any properties with this.set('myProperty', 'value');
11+
// Handle any actions with this.set('myAction', function(val) { ... });
12+
13+
await render(hbs`{{<%= componentPathName %>}}`);
14+
15+
assert.equal(this.element.textContent.trim(), '');
16+
17+
// Template block usage:
18+
await render(hbs`
19+
{{#<%= componentPathName %>}}
20+
template block text
21+
{{/<%= componentPathName %>}}
22+
`);
23+
24+
assert.equal(this.element.textContent.trim(), 'template block text');
25+
});
26+
});<% } else if (testType === 'unit') { %>import { module, test } from 'qunit';
27+
import { setupTest } from 'ember-qunit';
28+
29+
module('<%= friendlyTestDescription %>', function(hooks) {
30+
setupTest(hooks);
31+
32+
test('it exists', function(assert) {
33+
let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
34+
assert.ok(component);
35+
});
36+
});<% } %>

blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.ts

-36
This file was deleted.

blueprints/component/module-unification-files/__root__/__path__/component.ts

-7
This file was deleted.

blueprints/component/module-unification-files/__root__/__path__/template.hbs

-1
This file was deleted.

blueprints/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.ts

-16
This file was deleted.

0 commit comments

Comments
 (0)