Skip to content

Commit

Permalink
Better HTTPs tests
Browse files Browse the repository at this point in the history
Ensure that cert & key are specified as buffers, and save them in config/env/development.js so that Lodash's merge will be applied.  Lodash 3.x merge transforms buffers to arrays, so this tests our fix in 7ae836b
  • Loading branch information
sgress454 committed Feb 2, 2016
1 parent 24a19bb commit 20ff115
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions test/integration/lift.https.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ describe('Starting HTTPS sails server with lift', function() {
var sailsServer;

before(function() {
var opts = {
ssl: {
key: require('fs').readFileSync(require('path').resolve(__dirname, 'cert','sailstest-key.pem')).toString(),
cert: require('fs').readFileSync(require('path').resolve(__dirname, 'cert','sailstest-cert.pem')).toString()
}
};
fs.writeFileSync(path.resolve('../', appName, 'config/ssl.js'), "module.exports = " + JSON.stringify(opts) + ";");
fs.writeFileSync(path.resolve('../', appName, 'config/env/development.js'), "module.exports = {ssl: {key: require('fs').readFileSync('"+require('path').resolve(__dirname, 'cert','sailstest-key.pem')+"'), cert: require('fs').readFileSync('"+require('path').resolve(__dirname, 'cert','sailstest-cert.pem')+"')}};");
});

after(function(done) {
Expand Down Expand Up @@ -69,16 +63,7 @@ describe('Starting HTTPS sails server with lift', function() {
var sailsServer;

before(function() {
var opts = {
ssl: true,
http: {
serverOptions: {
key: require('fs').readFileSync(require('path').resolve(__dirname, 'cert','sailstest-key.pem')).toString(),
cert: require('fs').readFileSync(require('path').resolve(__dirname, 'cert','sailstest-cert.pem')).toString()
}
}
};
fs.writeFileSync(path.resolve('../', appName, 'config/ssl.js'), "module.exports = " + JSON.stringify(opts) + ";");
fs.writeFileSync(path.resolve('../', appName, 'config/env/development.js'), "module.exports = {ssl: true, http: {serverOptions: { key: require('fs').readFileSync('"+require('path').resolve(__dirname, 'cert','sailstest-key.pem')+"'), cert: require('fs').readFileSync('"+require('path').resolve(__dirname, 'cert','sailstest-cert.pem')+"')}}};");
});

after(function(done) {
Expand Down

0 comments on commit 20ff115

Please sign in to comment.