Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blueprints/util-test: Add RFC232 variants #15947

Merged
merged 2 commits into from
Dec 9, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import <%= camelizedModuleName %> from '<%= dasherizedModulePrefix %>/utils/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. In general I think that we probably don’t need this? I would expect utils to invoke the util method and test its inputs and outputs. Let’s remove setupTest here for now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed 👍


// Replace this with your real tests.
test('it works', function(assert) {
let result = <%= camelizedModuleName %>();
assert.ok(result);
});
});
14 changes: 14 additions & 0 deletions node-tests/blueprints/util-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;

const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
const fixture = require('../helpers/fixture');

describe('Blueprint: util-test', function() {
Expand All @@ -26,6 +27,19 @@ describe('Blueprint: util-test', function() {
});
});

describe('with ember-cli-qunit@4.1.1', function() {
beforeEach(function() {
generateFakePackageManifest('ember-cli-qunit', '4.1.1');
});

it('util-test foo-bar', function() {
return emberGenerateDestroy(['util-test', 'foo-bar'], _file => {
expect(_file('tests/unit/utils/foo-bar-test.js'))
.to.equal(fixture('util-test/rfc232.js'));
});
});
});

describe('with ember-cli-mocha', function() {
beforeEach(function() {
modifyPackages([
Expand Down
13 changes: 13 additions & 0 deletions node-tests/fixtures/util-test/rfc232.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import fooBar from 'my-app/utils/foo-bar';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('Unit | Utility | foo bar', function(hooks) {
setupTest(hooks);

// Replace this with your real tests.
test('it works', function(assert) {
let result = fooBar();
assert.ok(result);
});
});