refactoring, add alexa tests

This commit is contained in:
Jason Calabrese
2016-11-12 12:55:21 -08:00
parent f4919d76b0
commit 00b93d572d
18 changed files with 474 additions and 240 deletions
+20
View File
@@ -84,6 +84,26 @@ describe('Uploader Battery', function ( ) {
upbat.updateVisualisation(sbx);
});
it('should handle alexa requests', function (done) {
var ctx = {
settings: {}
};
var sandbox = require('../lib/sandbox')();
var sbx = sandbox.clientInit(ctx, Date.now(), data);
var upbat = require('../lib/plugins/upbat')();
upbat.setProperties(sbx);
upbat.alexa.intentHandlers.length.should.equal(1);
upbat.alexa.intentHandlers[0].intentHandler(function next(title, response) {
title.should.equal('Uploader battery');
response.should.equal('Your uploader battery is at 25 percent');
done();
}, [], sbx);
});
});