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

Commit

Permalink
chore: cleanup all legacy test blueprints support
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Nov 14, 2020
1 parent 342f2ca commit f565101
Show file tree
Hide file tree
Showing 124 changed files with 713 additions and 2,265 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import { describe, it, beforeEach, afterEach } from 'mocha';
import { describe, it } from 'mocha';
import { expect } from 'chai';
import startApp from '<%= dasherizedPackageName %>/tests/helpers/start-app';
<% if (destroyAppExists) { %>import destroyApp from '<%= dasherizedPackageName %>/tests/helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop';<% } %>
import { setupApplicationTest } from 'ember-mocha';
import { visit, currentURL } from '@ember/test-helpers';

describe('<%= friendlyTestName %>', function() {
let application;
setupApplicationTest();

beforeEach(function() {
application = startApp();
});

afterEach(function() {
<% if (destroyAppExists) { %>destroyApp(application);<% } else { %>run(application, 'destroy');<% } %>
});

it('can visit /<%= dasherizedModuleName %>', function() {
visit('/<%= dasherizedModuleName %>');

return andThen(() => {
expect(currentURL()).to.equal('/<%= dasherizedModuleName %>');
});
it('can visit /<%= dasherizedModuleName %>', async function() {
await visit('/<%= dasherizedModuleName %>');
expect(currentURL()).to.equal('/<%= dasherizedModuleName %>');
});
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { test } from 'qunit';
import moduleForAcceptance from '<%= testFolderRoot %>/tests/helpers/module-for-acceptance';
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';

moduleForAcceptance('<%= friendlyTestName %>');
module('<%= friendlyTestName %>', function(hooks) {
setupApplicationTest(hooks);

test('visiting /<%= dasherizedModuleName %>', function(assert) {
visit('/<%= dasherizedModuleName %>');
test('visiting /<%= dasherizedModuleName %>', async function(assert) {
await visit('/<%= dasherizedModuleName %>');

andThen(function() {
assert.equal(currentURL(), '/<%= dasherizedModuleName %>');
});
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { moduleFor, test } from 'ember-qunit';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

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

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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
import { expect } from 'chai';
import { describeComponent, it } from 'ember-mocha';<% if (testType === 'integration') { %>
import hbs from 'htmlbars-inline-precompile';<% } %>

describeComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>',
{
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test
// needs: ['component:foo', 'helper:bar'],
unit: true<% } %>
},
function() {
it('renders', function() {
<% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
// Template block usage:
// this.render(hbs`
// {{#<%= dasherizedModuleName %>}}
// template content
// {{/<%= dasherizedModuleName %>}}
// `);

this.render(hbs`{{<%= dasherizedModuleName %>}}`);
expect(this.$()).to.have.length(1);<% } else if(testType === 'unit') { %>// creates the component instance
let component = this.subject();
// renders the component on the page
this.render();
expect(component).to.be.ok;
expect(this.$()).to.have.length(1);<% } %>
});
}
);
<% if (testType === 'integration') { %>import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

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

it('renders', async function() {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{<%= componentPathName %>}}`);

expect(this.element.textContent.trim()).to.equal('');

// Template block usage:
await render(hbs`
{{#<%= componentPathName %>}}
template block text
{{/<%= componentPathName %>}}
`);

expect(this.element.textContent.trim()).to.equal('template block text');
});
});<% } else if (testType === 'unit') { %>import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';

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

it('exists', function() {
let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
expect(component).to.be.ok;
});
});<% } %>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
import { moduleForComponent, test } from 'ember-qunit';<% if (testType === 'integration') { %>
import hbs from 'htmlbars-inline-precompile';<% } %>

moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', {
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test
// needs: ['component:foo', 'helper:bar'],
unit: true<% } %>
});

test('it renders', function(assert) {
<% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });

this.render(hbs`{{<%= componentPathName %>}}`);

assert.equal(this.$().text().trim(), '');

// Template block usage:
this.render(hbs`
{{#<%= componentPathName %>}}
template block text
{{/<%= componentPathName %>}}
`);

assert.equal(this.$().text().trim(), 'template block text');<% } else if(testType === 'unit') { %>
// Creates the component instance
/*let component =*/ this.subject();
// Renders the component to the page
this.render();
assert.equal(this.$().text().trim(), '');<% } %>
});
<% if (testType === 'integration') { %>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('<%= friendlyTestDescription %>', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{<%= componentPathName %>}}`);

assert.equal(this.element.textContent.trim(), '');

// Template block usage:
await render(hbs`
{{#<%= componentPathName %>}}
template block text
{{/<%= componentPathName %>}}
`);

assert.equal(this.element.textContent.trim(), 'template block text');
});
});<% } else if (testType === 'unit') { %>import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

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

test('it exists', function(assert) {
let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
assert.ok(component);
});
});<% } %>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit f565101

Please sign in to comment.