UNPKG

1.57 kBJavaScriptView Raw
1const expect = require('chai').expect;
2const denodeify = require('denodeify');
3const request = denodeify(require('request'));
4const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
5const path = require('path');
6const fs = require('fs-extra');
7
8describe('Fastboot compatibility', function() {
9 this.timeout(10000000);
10 let app;
11
12 before(function() {
13 app = new AddonTestApp();
14
15 return app.create('dummy', {
16 fixturesPath: 'node-tests/fixtures',
17 emberVersion: 'latest',
18 skipNpm: true
19 })
20 .then(() => {
21 app.editPackageJSON(pkg => {
22 pkg.devDependencies['ember-cli-fastboot'] = 'latest';
23 });
24 return app.run('npm', 'install');
25 }).then(() => {
26 // https://github.com/tomdale/ember-cli-addon-tests/issues/176
27 let addonPath = path.join(app.path, 'node_modules', 'ember-service-worker');
28 fs.removeSync(addonPath);
29 fs.ensureSymlinkSync(process.cwd(), addonPath);
30 }).then(() => {
31 return app.startServer({
32 detectServerStart(output) {
33 return output.indexOf('Serving on ') > -1;
34 }
35 });
36 });
37 });
38
39 after(function() {
40 return app.stopServer();
41 });
42
43 it('includes renders', () => {
44 return request({
45 url: 'http://localhost:49741',
46 headers: {
47 'Accept': 'text/html'
48 }
49 }).then(response => {
50 expect(response.statusCode).to.equal(200);
51 expect(response.body).to.contain('Congratulations, you made it!')
52 expect(response.body).to.contain('<script src="/sw-registration.js"');
53 });
54 });
55});