-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to specify host address to bind servers to (#37)
- Loading branch information
1 parent
f2bfb23
commit e2954da
Showing
4 changed files
with
86 additions
and
15 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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*jshint expr: true*/ | ||
"use strict"; | ||
var chai = require("chai"); | ||
var expect = chai.expect; | ||
chai.config.includeStack = true; | ||
var request = require("supertest-as-promised"); | ||
var alexaAppServer = require("../index"); | ||
|
||
// used so that testing https requests will work properly | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; | ||
|
||
describe("Alexa App Server with Examples & Custom Server Bindings", function() { | ||
var testServer; | ||
|
||
afterEach(function() { | ||
testServer.stop(); | ||
}); | ||
|
||
it("mounts hello world app (HTTP only) and bind to the specified address", function() { | ||
testServer = alexaAppServer.start({ | ||
port: 3000, | ||
host: "127.0.0.1", | ||
server_root: 'examples' | ||
}); | ||
|
||
return request("http://127.0.0.1:3000") | ||
.get('/alexa/helloworld') | ||
.expect(200); | ||
}); | ||
|
||
it("mounts hello world app (HTTP & HTTPS) and bind to the specified address", function() { | ||
testServer = alexaAppServer.start({ | ||
port: 3000, | ||
host: "127.0.0.1", | ||
server_root: 'examples', | ||
httpsEnabled: true, | ||
httpsPort: 6000, | ||
privateKey: 'private-key.pem', | ||
certificate: 'cert.cer' | ||
}); | ||
|
||
return request("https://127.0.0.1:6000") | ||
.get('/alexa/helloworld') | ||
.expect(200); | ||
}); | ||
}); |