Skip to content

Commit

Permalink
updating tests to run with ember-data 3.10 and async await
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiupover committed Jul 30, 2020
1 parent 1ffdaf3 commit b7c9e4f
Show file tree
Hide file tree
Showing 17 changed files with 190 additions and 152 deletions.
24 changes: 14 additions & 10 deletions packages/ember-cli-fastboot/test/asset-rewriting-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ describe('rewriting HTML', function() {

let app;

before(function() {
before(async function() {
app = new AddonTestApp();

return app.create('dummy');
await app.create('dummy', {
emberDataVersion: "3.10.0",
skipNpm: true
});

await app.run('npm', 'install');
});

it('builds an index.html that points to the browser build', function() {
return app.runEmberCommand('build', '--environment=production')
.then(function() {
let appPath = glob.sync(app.filePath('dist/assets/dummy-*.js'))[0];
let matches = appPath.match(/dist\/assets\/dummy-(.*).js/);
let appSHA = matches[1];
it('builds an index.html that points to the browser build', async function() {
await app.runEmberCommand('build', '--environment=production');

let appPath = glob.sync(app.filePath('dist/assets/dummy-*.js'))[0];
let matches = appPath.match(/dist\/assets\/dummy-(.*).js/);
let appSHA = matches[1];

expect(app.filePath('dist/index.html')).to.have.content.that.match(new RegExp(appSHA));
});
expect(app.filePath('dist/index.html')).to.have.content.that.match(new RegExp(appSHA));
});

});
14 changes: 7 additions & 7 deletions packages/ember-cli-fastboot/test/async-content-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ describe('async content via deferred content', function() {

let app;

before(function() {
before(async function() {
app = new AddonTestApp();

return app.create('async-content')
.then(function() {
return app.startServer({
command: 'serve'
});
});
await app.create('async-content', {
emberDataVersion: "3.10.0",
skipNpm: true
})
await app.run('npm', 'install');
return app.startServer({command: 'serve'});
});

after(function() {
Expand Down
9 changes: 7 additions & 2 deletions packages/ember-cli-fastboot/test/build-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ describe('it builds', function() {

let app;

before(function() {
before(async function() {
app = new AddonTestApp();

return app.create('dummy');
await app.create('dummy', {
emberDataVersion: "3.10.0",
skipNpm: true
});

await app.run('npm', 'install');
});

it('builds into dist by default', function() {
Expand Down
16 changes: 9 additions & 7 deletions packages/ember-cli-fastboot/test/custom-html-file-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ describe('custom htmlFile', function() {

let app;

before(function() {
before(async function() {
app = new AddonTestApp();

return app.create('custom-html-file')
.then(function() {
return app.startServer({
command: 'serve'
});
});
await app.create('custom-html-file', {
emberDataVersion: "3.10.0",
skipNpm: true
});
await app.run('npm', 'install');
return app.startServer({
command: 'serve'
});
});

after(function() {
Expand Down
12 changes: 7 additions & 5 deletions packages/ember-cli-fastboot/test/dynamic-initializers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ describe('dynamic initializers', function() {

let app;

before(function() {
before(async function() {
app = new AddonTestApp();

return app.create('dynamic-initializers')
.then(function() {
return app.runEmberCommand('build');
});
await app.create('dynamic-initializers', {
emberDataVersion: "3.10.0",
skipNpm: true
});
await app.run('npm', 'install');
return app.runEmberCommand('build')
});

it('filters FastBoot initializers from browser build', function() {
Expand Down
16 changes: 9 additions & 7 deletions packages/ember-cli-fastboot/test/error-handler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ describe('error handler acceptance', function() {

let app;

before(function() {
before(async function() {
app = new AddonTestApp();

return app.create('error-handler')
.then(function() {
return app.startServer({
command: 'serve'
});
});
await app.create('error-handler', {
emberDataVersion: "3.10.0",
skipNpm: true
});
await app.run('npm', 'install');
return app.startServer({
command: 'serve'
});
});

after(function() {
Expand Down
16 changes: 9 additions & 7 deletions packages/ember-cli-fastboot/test/fastboot-config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ describe('FastBoot config', function() {

let app;

before(function() {
before(async function () {
app = new AddonTestApp();

return app.create('fastboot-config')
.then(function() {
return app.startServer({
command: 'serve'
});
});
await app.create('fastboot-config', {
emberDataVersion: "3.10.0",
skipNpm: true
});
await app.run('npm', 'install');
return app.startServer({
command: 'serve'
});
});

after(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ describe('FastBootLocation Configuration', function() {
this.timeout(300000);

let app;

before(function() {
before(async function () {
app = new AddonTestApp();

return app.create('fastboot-location-config').then(function() {
return app.startServer({
command: 'serve'
});
await app.create('fastboot-location-config', {
emberDataVersion: "3.10.0",
skipNpm: true
});
await app.run('npm', 'install');
return app.startServer({
command: 'serve'
});
});

Expand Down
13 changes: 8 additions & 5 deletions packages/ember-cli-fastboot/test/fastboot-location-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ describe('FastBootLocation', function() {
this.timeout(300000);

let app;
before(function() {
before(async function () {
app = new AddonTestApp();

return app.create('fastboot-location').then(function() {
return app.startServer({
command: 'serve'
});
await app.create('fastboot-location', {
emberDataVersion: "3.10.0",
skipNpm: true
});
await app.run('npm', 'install');
return app.startServer({
command: 'serve'
});
});

Expand Down
22 changes: 11 additions & 11 deletions packages/ember-cli-fastboot/test/head-content-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ describe('head content acceptance', function() {
this.timeout(300000);

let app;

before(function() {
before(async function () {
app = new AddonTestApp();

return app.create('head-content', {
await app.create('head-content', {
emberDataVersion: "3.10.0",
skipNpm: true
})
.then(addDependencies)
.then(function() {
return app.startServer({
command: 'serve'
});
});
});

addDependencies(app);

await app.run('npm', 'install');
return app.startServer({
command: 'serve'
});
});

after(function() {
Expand All @@ -48,5 +49,4 @@ function addDependencies(app) {
app.editPackageJSON(function(pkg) {
pkg['devDependencies']['ember-cli-head'] = "0.3.1";
});
return app.run('npm', 'install');
}
75 changes: 42 additions & 33 deletions packages/ember-cli-fastboot/test/package-json-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;

chai.use(require('chai-fs'));

describe('generating package.json', function() {
describe.only('generating package.json', function() {
this.timeout(300000);

let app;

before(function() {
before(async function () {
app = new AddonTestApp();

return app.create('module-whitelist', {
await app.create('module-whitelist', {
emberDataVersion: "3.10.0",
skipNpm: true
})
.then(addFastBootDeps)
.then(function() {
return app.run('npm', 'install');
});
});

addFastBootDeps(app);

await app.run('npm', 'install');
});

describe('with FastBoot builds', function() {
Expand Down Expand Up @@ -117,19 +118,18 @@ describe('generating package.json', function() {
describe('with addon that implements fastbootConfigTree', function() {
let app;

before(function() {
before(async function () {
app = new AddonTestApp();

return app.create('fastboot-config', {
await app.create('fastboot-config', {
emberDataVersion: "3.10.0",
skipNpm: true
})
.then(addFastBootDeps)
.then(function() {
return app.run('npm', 'install');
})
.then(function() {
return app.runEmberCommand('build');
});
});

addFastBootDeps(app);

await app.run('npm', 'install');
await app.runEmberCommand('build');
});

it('it extends the application config', function() {
Expand Down Expand Up @@ -178,12 +178,15 @@ describe('generating package.json', function() {
describe('with customized fingerprinting options', function() {
// Tests an app with a custom `assetMapPath` set
let customApp = new AddonTestApp();
before(async function () {

before(function() {
return customApp.create('customized-fingerprinting')
.then(function() {
return customApp.runEmberCommand('build', '--environment=production');
});
await customApp.create('customized-fingerprinting', {
emberDataVersion: "3.10.0",
skipNpm: true
});

await app.run('npm', 'install');
await customApp.runEmberCommand('build', '--environment=production');
});

it('respects a custom asset map path and prepended URLs', function() {
Expand Down Expand Up @@ -222,11 +225,14 @@ describe('generating package.json', function() {
// Tests an app with a custom `outputPaths` set
let customApp = new AddonTestApp();

before(function() {
return customApp.create('customized-outputpaths')
.then(function() {
return customApp.runEmberCommand('build');
});
before(async function () {
await customApp.create('customized-outputpaths', {
emberDataVersion: "3.10.0",
skipNpm: true
});

await app.run('npm', 'install');
await customApp.runEmberCommand('build');
});

it('respects custom output paths and maps to them in the manifest', function() {
Expand Down Expand Up @@ -254,12 +260,15 @@ describe('generating package.json', function() {
this.timeout(300000);

let customApp = new AddonTestApp();
before(async function () {

before(function() {
return customApp.create('custom-html-file')
.then(function() {
return customApp.runEmberCommand('build', '--environment=production');
});
await customApp.create('custom-html-file', {
emberDataVersion: "3.10.0",
skipNpm: true
});

await app.run('npm', 'install');
await customApp.runEmberCommand('build', '--environment=production');
});

it('uses custom htmlFile in the manifest', function() {
Expand Down
Loading

0 comments on commit b7c9e4f

Please sign in to comment.