Skip to content

Commit 028a422

Browse files
committed
Add test-helper generator.
1 parent e437db9 commit 028a422

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { registerAsyncHelper } from '@ember/test';
2+
3+
export default registerAsyncHelper('<%= camelizedModuleName %>', function(app) {
4+
5+
});

blueprints/test-helper/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = {
4+
description: 'Generates a test helper.'
5+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
const blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers');
4+
const setupTestHooks = blueprintHelpers.setupTestHooks;
5+
const emberNew = blueprintHelpers.emberNew;
6+
const emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy;
7+
8+
const chai = require('ember-cli-blueprint-test-helpers/chai');
9+
const expect = chai.expect;
10+
11+
describe('Blueprint: test-helper', function() {
12+
setupTestHooks(this);
13+
14+
describe('in app', function() {
15+
beforeEach(function() {
16+
return emberNew();
17+
});
18+
19+
it('test-helper foo', function() {
20+
return emberGenerateDestroy(['test-helper', 'foo'], _file => {
21+
expect(_file('tests/helpers/foo.ts'))
22+
.to.contain("import { registerAsyncHelper } from '@ember/test';")
23+
.to.contain("export default registerAsyncHelper('foo', function(app) {\n\n}");
24+
});
25+
});
26+
});
27+
});

0 commit comments

Comments
 (0)