Skip to content

Commit

Permalink
blueprints/helper-test: Add RFC232 variants
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Dec 7, 2017
1 parent c1ca4b4 commit a1c4629
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<% 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('helper:<%= dasherizedModuleName %>', function(hooks) {
setupRenderingTest(hooks);

// Replace this with your real tests.
test('it renders', async function(assert) {
this.set('inputValue', '1234');

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

assert.equal(this.$().text().trim(), '1234');
});
});<% } else if (testType == 'unit') { %>import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

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

// Replace this with your real tests.
test('it works', function(assert) {
let result = <%= camelizedModuleName %>([42]);
assert.ok(result);
});
});<% } %>

12 changes: 12 additions & 0 deletions node-tests/fixtures/helper-test/rfc232-unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('Unit | Helper | foo/bar baz', function(hooks) {
setupTest(hooks);

test('it works', function(assert) {
let result = fooBarBaz([42]);
assert.ok(result);
});
});
16 changes: 16 additions & 0 deletions node-tests/fixtures/helper-test/rfc232.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Helper | foo/bar-baz', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
this.set('inputValue', '1234');

await render(hbs`{{foo/bar-baz inputValue}}`);

assert.equal(this.$().text().trim(), '1234');
});
});
4 changes: 1 addition & 3 deletions node-tests/fixtures/helper-test/unit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';
import { module, test } from 'qunit';

Expand All @@ -8,5 +7,4 @@ module('Unit | Helper | foo/bar baz');
test('it works', function(assert) {
let result = fooBarBaz([42]);
assert.ok(result);
});

});

0 comments on commit a1c4629

Please sign in to comment.