Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Node.js v0.12 - v7 #139

Merged
merged 4 commits into from
Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
---
language: node_js
node_js:
- "5.11"

sudo: false

node_js:
- '0.12'
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'

cache:
directories:
- node_modules
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Changelog

### 2.4.1 (Next)

* [#139](https://github.com/alexa-js/alexa-app/pull/139): Changed arrow functions to normal functions (see https://mochajs.org/#arrow-functions for more info) - [@tejashah88](https://github.com/tejashah88).
* [#139](https://github.com/alexa-js/alexa-app/pull/139): Added more node versions to run mocha tests on Travis-CI - [@tejashah88](https://github.com/tejashah88).
* [#125](https://github.com/alexa-js/alexa-app/pull/125): Force new when instantiating alexa.app - [@OpenDog](https://github.com/OpenDog).
* [#119](https://github.com/alexa-js/alexa-app/pull/119): Moved to the [alexa-js organization](https://github.com/alexa-js) - [@dblock](https://github.com/dblock).
* [#118](https://github.com/matt-kruse/alexa-app/pull/118), [#117](https://github.com/matt-kruse/alexa-app/issues/117): Prevent updating session attributes directly - [@ajcrites](https://github.com/ajcrites).
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,21 @@
"numbered": "^1.0.0"
},
"devDependencies": {
"body-parser": "^1.15.2",
"chai": "^3.4.1",
"chai-as-promised": "^5.3.0",
"sinon": "^1.17.7",
"sinon-chai": "^2.8.0",
"express": "^4.14.0",
"supertest": "^2.0.1",
"supertest-as-promised": "^4.0.2",
"chai-string": "^1.3.0",
"coveralls": "^2.11.9",
"danger": "0.6.10",
"ejs": "^2.5.5",
"eslint": "^2.9.0",
"esprima": "^3.1.3",
"express": "^4.14.0",
"istanbul": "^0.4.3",
"mocha": "^2.3.4",
"danger": "0.6.10",
"body-parser": "^1.15.2",
"ejs": "^2.5.5",
"chai-string": "^1.3.0"
"sinon": "^1.17.7",
"sinon-chai": "^2.8.0",
"supertest": "^2.0.1",
"supertest-as-promised": "^4.0.2"
}
}
32 changes: 16 additions & 16 deletions test/test_alexa_app_audioplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,63 @@ describe("Alexa", function () {

describe("app", function () {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

describe("request", function () {

context("without an audioPlayer intent", function () {
context("AudioPlayer.PlaybackFinished", () => {
context("AudioPlayer.PlaybackFinished", function() {
var mockRequest;
beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_finished.json"); })
beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_finished.json"); })

it("should succeed and return empty object ", () => {
it("should succeed and return empty object ", function() {
return testApp.request(mockRequest)
.should.eventually.be.fulfilled
.and.not.have.deep.property("response.outputSpeech.type");
});
});

context("AudioPlayer.PlaybackFailed", () => {
context("AudioPlayer.PlaybackFailed", function() {
var mockRequest;
beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_failed.json"); })
beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_failed.json"); })

it("should succeed and return empty object ", () => {
it("should succeed and return empty object ", function() {
return testApp.request(mockRequest)
.should.eventually.be.fulfilled
.and.not.have.deep.property("response.outputSpeech.type");
});
});

context("AudioPlayer.PlaybackNearlyFinished", () => {
context("AudioPlayer.PlaybackNearlyFinished", function() {
var mockRequest;
beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_nearly_finished.json"); })
beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_nearly_finished.json"); })

it("should succeed and return empty object ", () => {
it("should succeed and return empty object ", function() {
return testApp.request(mockRequest)
.should.eventually.be.fulfilled
.and.not.have.deep.property("response.outputSpeech.type");
});
});


context("AudioPlayer.PlaybackStarted", () => {
context("AudioPlayer.PlaybackStarted", function() {
var mockRequest;
beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_started.json"); })
beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_started.json"); })

it("should succeed and return empty object ", () => {
it("should succeed and return empty object ", function() {
return testApp.request(mockRequest)
.should.eventually.be.fulfilled
.and.not.have.deep.property("response.outputSpeech.type");
});
});

context("AudioPlayer.PlaybackStopped", () => {
context("AudioPlayer.PlaybackStopped", function() {
var mockRequest;
beforeEach(() => { mockRequest = mockHelper.load("audio_player_events/playback_stopped.json"); })
beforeEach(function() { mockRequest = mockHelper.load("audio_player_events/playback_stopped.json"); })

it("should succeed and return empty object ", () => {
it("should succeed and return empty object ", function() {
return testApp.request(mockRequest)
.should.eventually.be.fulfilled
.and.not.have.deep.property("response.outputSpeech.type");
Expand Down
2 changes: 1 addition & 1 deletion test/test_alexa_app_cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand Down
2 changes: 1 addition & 1 deletion test/test_alexa_app_initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand Down
6 changes: 3 additions & 3 deletions test/test_alexa_app_intent.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand All @@ -22,7 +22,7 @@ describe("Alexa", function() {
context("with schema", function() {
var schema = { schema: "yes" };

beforeEach(() => {
beforeEach(function() {
testApp.intent("airportInfoIntent", schema, func);
});

Expand All @@ -40,7 +40,7 @@ describe("Alexa", function() {
});

context("without schema", function() {
beforeEach(() => {
beforeEach(function() {
testApp.intent("airportInfoIntent", func);
});

Expand Down
8 changes: 4 additions & 4 deletions test/test_alexa_app_intent_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand All @@ -24,7 +24,7 @@ describe("Alexa", function() {
describe("defaults", function() {
var subject;

beforeEach(() => {
beforeEach(function() {
subject = testApp.request(mockRequest);
})

Expand All @@ -46,7 +46,7 @@ describe("Alexa", function() {
context("with no intent handler", function() {
var subject;

beforeEach(() => {
beforeEach(function() {
subject = testApp.request(mockRequest);
})

Expand All @@ -67,7 +67,7 @@ describe("Alexa", function() {
context("with a matching intent handler", function() {
var expectedMessage = "tubular!";

beforeEach(() => {
beforeEach(function() {
var intentHandler = function(req, res) {
res.say(expectedMessage);
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/test_alexa_app_launch_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand Down
4 changes: 2 additions & 2 deletions test/test_alexa_app_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

describe("#schema", function() {
beforeEach(() => {
beforeEach(function() {
testApp.intent("testIntentTwo", {
"slots": {
"MyCustomSlotType": "CUSTOMTYPE",
Expand Down
10 changes: 5 additions & 5 deletions test/test_alexa_app_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("Alexa", function() {
var Alexa = require("../index");
describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand All @@ -21,7 +21,7 @@ describe("Alexa", function() {
context("intent handler with shouldEndSession = false", function() {
var reqObject;

beforeEach(() => {
beforeEach(function() {
var intentHandler = function(req, res) {
res.say("message").shouldEndSession(false);
res.session("foo", true);
Expand All @@ -36,7 +36,7 @@ describe("Alexa", function() {
});

it("reponds with expected context applicationId", function() {
return testApp.request(mockRequest).then((response) => {
return testApp.request(mockRequest).then(function(response) {
expect(reqObject.context).to
.have.deep.property(
"System.application.applicationId",
Expand Down Expand Up @@ -299,7 +299,7 @@ describe("Alexa", function() {
returnedAttributeValue = req.getSession().get("AttributeWhichDoesNotExist");
};

return testApp.request(mockRequest).then(() => expect(returnedAttributeValue).to.not.be.undefined);
return testApp.request(mockRequest).then(function() { expect(returnedAttributeValue).to.not.be.undefined; });
});
});
});
Expand All @@ -315,7 +315,7 @@ describe("Alexa", function() {
returnedAttributeValue = req.getSession().get("AttributeWhichDoesNotExist");
};

return testApp.request(mockRequest).then(() => expect(returnedAttributeValue).to.be.undefined);
return testApp.request(mockRequest).then(function() { expect(returnedAttributeValue).to.be.undefined; });
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/test_alexa_app_session_ended_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand Down
2 changes: 1 addition & 1 deletion test/test_alexa_app_unknown_type_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand Down
4 changes: 2 additions & 2 deletions test/test_alexa_app_utterances_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ describe("Alexa", function() {
var Alexa = require("../index");
describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

describe("#utterances", function() {
beforeEach(() => {
beforeEach(function() {
testApp.intent("testIntentTwo", {
"slots": {
"NAME": "LITERAL",
Expand Down
10 changes: 5 additions & 5 deletions test/test_alexa_integration_express.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Alexa", function() {
var testServer;
var testApp;

beforeEach(() => {
beforeEach(function() {
app = express();
app.use(bodyParser.json());
app.set('views', path.join(__dirname, 'views'));
Expand All @@ -33,12 +33,12 @@ describe("Alexa", function() {
testServer = app.listen(3000);
});

afterEach(() => {
afterEach(function() {
testServer.close();
});

context("#express with default options", function() {
beforeEach(() => {
beforeEach(function() {
testApp.express(app, '/')
});

Expand Down Expand Up @@ -72,7 +72,7 @@ describe("Alexa", function() {
});

context("#express with debug set to true", function() {
beforeEach(() => {
beforeEach(function() {
testApp.express(app, '/', true)
});

Expand All @@ -86,7 +86,7 @@ describe("Alexa", function() {
});

context("#express with debug set to false", function() {
beforeEach(() => {
beforeEach(function() {
testApp.express(app, '/', false)
});

Expand Down
2 changes: 1 addition & 1 deletion test/test_alexa_integration_lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("Alexa", function() {

describe("app", function() {
var testApp;
beforeEach(() => {
beforeEach(function() {
testApp = new Alexa.app("testApp");
});

Expand Down