Skip to content

Commit 32b9663

Browse files
author
Robert Jackson
authored
Merge pull request #797 from kiwiupover/move-dynamic-initializers-test
2 parents 6b9b928 + d73bda3 commit 32b9663

9 files changed

Lines changed: 55 additions & 31 deletions

File tree

packages/ember-cli-fastboot/test/fixtures/dynamic-initializers/app/initializers/initializer.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/ember-cli-fastboot/test/fixtures/dynamic-initializers/app/instance-initializers/initializer.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/ember-cli-fastboot/test/fixtures/dynamic-initializers/fastboot/initializers/initializer.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/ember-cli-fastboot/test/fixtures/dynamic-initializers/fastboot/instance-initializers/initializer.js

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
name: 'app-initializer',
3+
4+
initialize() {
5+
return `Well, Prince, so Genoa and Lucca are now just family estates of the
6+
Buonapartes.`
7+
}
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
name: 'instant-initialize',
3+
initialize() {
4+
return `But how do you do? I see I have frightened
5+
you--sit down and tell me all the news.`
6+
}
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
name: 'initialize',
3+
initialize() {
4+
return `But I warn you, if you don't tell me that this means war,
5+
if you still try to defend the infamies and horrors perpetrated by that
6+
Antichrist--I really believe he is Antichrist--I will have nothing more
7+
to do with you and you are no longer my friend, no longer my 'faithful
8+
slave,' as you call yourself!`
9+
}
10+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
name: 'instant-initialize',
3+
initialize() {
4+
return `It was in July, 1805, and the speaker was the well-known Anna Pavlovna
5+
Scherer, maid of honor and favorite of the Empress Marya Fedorovna.`
6+
}
7+
}

packages/ember-cli-fastboot/test/dynamic-initializers-test.js renamed to test-packages/basic-app/test/dynamic-initialzer-test.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,53 @@
1-
'use strict';
2-
31
const chai = require('chai');
42
const expect = chai.expect;
5-
chai.use(require('chai-fs'));
3+
const glob = require("glob");
4+
const execa = require("execa");
65

7-
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
6+
chai.use(require('chai-fs'));
87

98
describe('dynamic initializers', function() {
10-
this.timeout(300000);
9+
this.timeout(100000);
1110

12-
let app;
13-
14-
before(function() {
15-
app = new AddonTestApp();
16-
17-
return app.create('dynamic-initializers', { emberVersion: 'latest'})
18-
.then(function() {
19-
return app.runEmberCommand('build');
20-
});
11+
before( async () => {
12+
await execa("yarn", ["build"]);
2113
});
2214

2315
it('filters FastBoot initializers from browser build', function() {
24-
let appPath = app.filePath('dist/assets/dynamic-initializers.js');
16+
const appPath = find('dist/assets/basic-app.js');
2517
expect(appPath).to.not.have.content.that.match(
2618
/But I warn you, if you don't tell me that this means war/);
19+
2720
expect(appPath).to.have.content.that.match(
2821
/Well, Prince, so Genoa and Lucca are now just family estates/);
2922
});
3023

3124
it('filters browser initializers from FastBoot build', function() {
32-
let appPath = app.filePath('dist/assets/dynamic-initializers-fastboot.js');
25+
const appPath = find('dist/assets/basic-app-fastboot.js');
26+
3327
expect(appPath).to.have.content.that.match(
3428
/But I warn you, if you don't tell me that this means war/);
3529
expect(appPath).to.not.have.content.that.match(
3630
/Well, Prince, so Genoa and Lucca are now just family estates/);
3731
});
3832

3933
it('filters FastBoot instance initializers from browser build', function() {
40-
let appPath = app.filePath('dist/assets/dynamic-initializers.js');
34+
const appPath = find('dist/assets/basic-app.js');
4135
expect(appPath).to.not.have.content.that.match(/It was in July, 1805/);
4236
expect(appPath).to.have.content.that.match(/But how do you do/);
4337
});
4438

4539
it('filters browser instance initializers from FastBoot build', function() {
46-
let appPath = app.filePath('dist/assets/dynamic-initializers-fastboot.js');
47-
expect(appPath).to.have.content.that.match(/It was in July, 1805/);
48-
expect(appPath).to.not.have.content.that.match(/But how do you do/);
40+
const appFastbootPath = find('dist/assets/basic-app-fastboot.js');
41+
42+
expect(appFastbootPath).to.have.content.that.match(/It was in July, 1805/);
43+
expect(appFastbootPath).to.not.have.content.that.match(/But how do you do/);
4944
});
45+
46+
function find(globPath) {
47+
let files = glob.sync(globPath);
48+
49+
expect(files.length).to.equal(1, globPath);
50+
51+
return files[0];
52+
}
5053
});

0 commit comments

Comments
 (0)