forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Update initializer blueprint for ember-mocha 0.14
Related to emberjs#16863
- Loading branch information
1 parent
f277f7e
commit 9376b05
Showing
4 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...ints/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { expect } from 'chai'; | ||
import { describe, it } from 'mocha'; | ||
import { setupTest } from 'ember-mocha'; | ||
import Application from '@ember/application'; | ||
import { initialize } from '<%= modulePrefix %>/initializers/<%= dasherizedModuleName %>'; | ||
<% if (destroyAppExists) { %>import destroyApp from '../../helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop';<% } %> | ||
|
||
describe('<%= friendlyTestName %>', function() { | ||
let hooks = setupTest(); | ||
|
||
hooks.beforeEach(function() { | ||
this.TestApplication = Application.extend(); | ||
this.TestApplication.initializer({ | ||
name: 'initializer under test', | ||
initialize | ||
}); | ||
|
||
this.application = this.TestApplication.create({ autoboot: false }); | ||
}); | ||
|
||
hooks.afterEach(function() { | ||
<% if (destroyAppExists) { %>destroyApp(this.application);<% } else { %>run(this.application, 'destroy');<% } %> | ||
}); | ||
|
||
// Replace this with your real tests. | ||
it('works', async function() { | ||
await this.application.boot(); | ||
|
||
// you would normally confirm the results of the initializer here | ||
expect(true).to.be.ok; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,21 @@ describe('Blueprint: initializer-test', function() { | |
}); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
beforeEach(function() { | ||
modifyPackages([{ name: 'ember-qunit', delete: true }, { name: 'ember-mocha', dev: true }]); | ||
generateFakePackageManifest('ember-mocha', '0.14.0'); | ||
}); | ||
|
||
it('initializer-test foo', function() { | ||
return emberGenerateDestroy(['initializer-test', 'foo'], _file => { | ||
expect(_file('tests/unit/initializers/foo-test.js')).to.equal( | ||
fixture('initializer-test/mocha-rfc232.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('in addon', function() { | ||
|
@@ -158,6 +173,21 @@ describe('Blueprint: initializer-test', function() { | |
}); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
beforeEach(function() { | ||
modifyPackages([{ name: 'ember-qunit', delete: true }, { name: 'ember-mocha', dev: true }]); | ||
generateFakePackageManifest('ember-mocha', '0.14.0'); | ||
}); | ||
|
||
it('initializer-test foo', function() { | ||
return emberGenerateDestroy(['initializer-test', 'foo'], _file => { | ||
expect(_file('src/init/initializers/foo-test.js')).to.equal( | ||
fixture('initializer-test/module-unification/mocha-rfc232.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('in addon - module unification', function() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { expect } from 'chai'; | ||
import { describe, it } from 'mocha'; | ||
import { setupTest } from 'ember-mocha'; | ||
import Application from '@ember/application'; | ||
import { initialize } from 'my-app/initializers/foo'; | ||
import { run } from '@ember/runloop'; | ||
|
||
describe('Unit | Initializer | foo', function() { | ||
let hooks = setupTest(); | ||
|
||
hooks.beforeEach(function() { | ||
this.TestApplication = Application.extend(); | ||
this.TestApplication.initializer({ | ||
name: 'initializer under test', | ||
initialize | ||
}); | ||
|
||
this.application = this.TestApplication.create({ autoboot: false }); | ||
}); | ||
|
||
hooks.afterEach(function() { | ||
run(this.application, 'destroy'); | ||
}); | ||
|
||
// Replace this with your real tests. | ||
it('works', async function() { | ||
await this.application.boot(); | ||
|
||
// you would normally confirm the results of the initializer here | ||
expect(true).to.be.ok; | ||
}); | ||
}); |
32 changes: 32 additions & 0 deletions
32
node-tests/fixtures/initializer-test/module-unification/mocha-rfc232.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { expect } from 'chai'; | ||
import { describe, it } from 'mocha'; | ||
import { setupTest } from 'ember-mocha'; | ||
import Application from '@ember/application'; | ||
import { initialize } from 'my-app/init/initializers/foo'; | ||
import { run } from '@ember/runloop'; | ||
|
||
describe('Unit | Initializer | foo', function() { | ||
let hooks = setupTest(); | ||
|
||
hooks.beforeEach(function() { | ||
this.TestApplication = Application.extend(); | ||
this.TestApplication.initializer({ | ||
name: 'initializer under test', | ||
initialize | ||
}); | ||
|
||
this.application = this.TestApplication.create({ autoboot: false }); | ||
}); | ||
|
||
hooks.afterEach(function() { | ||
run(this.application, 'destroy'); | ||
}); | ||
|
||
// Replace this with your real tests. | ||
it('works', async function() { | ||
await this.application.boot(); | ||
|
||
// you would normally confirm the results of the initializer here | ||
expect(true).to.be.ok; | ||
}); | ||
}); |