-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a warning when a developer users
hostWhitelist
- Loading branch information
1 parent
dcb6d03
commit 48e44c6
Showing
6 changed files
with
68 additions
and
56 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,42 +1,59 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
|
||
const expect = require('chai').use(require('chai-string')).expect; | ||
const RSVP = require('rsvp'); | ||
const request = RSVP.denodeify(require('request')); | ||
|
||
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp; | ||
|
||
describe('FastBoot config', function() { | ||
this.timeout(400000); | ||
const expect = require('chai').expect; | ||
const helpers = require('broccoli-test-helper'); | ||
const MockUI = require('console-ui/mock') | ||
const createBuilder = helpers.createBuilder; | ||
const createTempDir = helpers.createTempDir; | ||
const FastbootConfig = require('../lib/broccoli/fastboot-config'); | ||
|
||
|
||
describe('FastbootConfig', function() { | ||
let input; | ||
let output; | ||
let subject; | ||
let project; | ||
|
||
beforeEach(async function() { | ||
input = await createTempDir(); | ||
project = { | ||
addons: [], | ||
pkg: {}, | ||
}; | ||
subject = new FastbootConfig(input.path(), { | ||
project, | ||
outputPaths: { | ||
app: { js: 'app.js' }, | ||
vendor: { js: 'vendor.js' }, | ||
}, | ||
appConfig: { | ||
modulePrefix: 'app', | ||
}, | ||
ui: new MockUI(), | ||
fastbootAppConfig: { | ||
hostWhitelist: ['example.com', 'subdomain.example.com'] | ||
} | ||
}); | ||
output = createBuilder(subject); | ||
}); | ||
|
||
let app; | ||
afterEach(async function() { | ||
await input.dispose(); | ||
await output.dispose(); | ||
}); | ||
|
||
before(function() { | ||
app = new AddonTestApp(); | ||
it('it replace hostWhitelist with hostAllowList and warns user to update the config to hostAllowList', async function() { | ||
input.write({}); | ||
|
||
return app.create('fastboot-config', { emberVersion: 'latest'}) | ||
.then(function() { | ||
return app.startServer({ | ||
command: 'serve' | ||
}); | ||
}); | ||
}); | ||
await output.build(); | ||
|
||
after(function() { | ||
return app.stopServer(); | ||
}); | ||
expect( | ||
output.read() | ||
).to.deep.equal({ | ||
'package.json': `{"dependencies":{},"fastboot":{"appName":"app","config":{"app":{"modulePrefix":"app"}},"hostAllowList":["example.com","subdomain.example.com"],"manifest":{"appFiles":["app.js","app-fastboot.js"],"htmlFile":"index.html","vendorFiles":["vendor.js"]},"moduleAllowlist":[],"schemaVersion":3}}` | ||
}); | ||
|
||
it('provides sandbox globals', function() { | ||
return request({ | ||
url: 'http://localhost:49741/', | ||
headers: { | ||
'Accept': 'text/html' | ||
} | ||
}) | ||
.then(function(response) { | ||
expect(response.statusCode).to.equal(200); | ||
expect(response.headers['content-type']).to.equalIgnoreCase('text/html; charset=utf-8'); | ||
expect(response.body).to.contain('<h1>My Global</h1>'); | ||
}); | ||
expect(output.builder.outputNode.ui.output).to.contain('Please update your fastboot config to use `hostAllowList` of the deprecated `hostWhitelist`'); | ||
}); | ||
}); |
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
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
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 |
---|---|---|
|
@@ -5577,11 +5577,6 @@ clone@^2.0.0, clone@^2.1.2: | |
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" | ||
integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= | ||
|
||
[email protected]: | ||
version "4.6.0" | ||
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" | ||
integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= | ||
|
||
code-point-at@^1.0.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" | ||
|