mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Merge pull request #5137 from inventor96/update-virtual-assistants-v2
Update virtual assistants v2
This commit is contained in:
+4
-4
@@ -147,18 +147,18 @@ describe('ar2', function ( ) {
|
||||
done();
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
var now = Date.now();
|
||||
var before = now - FIVE_MINS;
|
||||
|
||||
ctx.ddata.sgvs = [{mgdl: 100, mills: before}, {mgdl: 105, mills: now}];
|
||||
var sbx = prepareSandbox();
|
||||
|
||||
ar2.alexa.intentHandlers.length.should.equal(1);
|
||||
ar2.virtAsst.intentHandlers.length.should.equal(1);
|
||||
|
||||
ar2.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
ar2.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('AR2 Forecast');
|
||||
response.should.equal('You are expected to be between 109 and 120 over the in 30 minutes');
|
||||
response.should.equal('According to the AR2 forecast you are expected to be between 109 and 120 over the next in 30 minutes');
|
||||
done();
|
||||
}, [], sbx);
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('basalprofile', function ( ) {
|
||||
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
var data = {};
|
||||
|
||||
var ctx = {
|
||||
@@ -92,14 +92,14 @@ describe('basalprofile', function ( ) {
|
||||
var sbx = sandbox.clientInit(ctx, time, data);
|
||||
sbx.data.profile = profile;
|
||||
|
||||
basal.alexa.intentHandlers.length.should.equal(1);
|
||||
basal.alexa.rollupHandlers.length.should.equal(1);
|
||||
basal.virtAsst.intentHandlers.length.should.equal(1);
|
||||
basal.virtAsst.rollupHandlers.length.should.equal(1);
|
||||
|
||||
basal.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
basal.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Current Basal');
|
||||
response.should.equal('Your current basal is 0.175 units per hour');
|
||||
|
||||
basal.alexa.rollupHandlers[0].rollupHandler([], sbx, function callback (err, response) {
|
||||
basal.virtAsst.rollupHandlers[0].rollupHandler([], sbx, function callback (err, response) {
|
||||
should.not.exist(err);
|
||||
response.results.should.equal('Your current basal is 0.175 units per hour');
|
||||
response.priority.should.equal(1);
|
||||
|
||||
+3
-3
@@ -97,7 +97,7 @@ describe('COB', function ( ) {
|
||||
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
var data = {
|
||||
treatments: [{
|
||||
carbs: '8'
|
||||
@@ -110,9 +110,9 @@ describe('COB', function ( ) {
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
cob.setProperties(sbx);
|
||||
|
||||
cob.alexa.intentHandlers.length.should.equal(1);
|
||||
cob.virtAsst.intentHandlers.length.should.equal(1);
|
||||
|
||||
cob.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
cob.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Current COB');
|
||||
response.should.equal('You have 8 carbohydrates on board');
|
||||
done();
|
||||
|
||||
+5
-5
@@ -11,7 +11,7 @@ describe('IOB', function() {
|
||||
|
||||
var iob = require('../lib/plugins/iob')(ctx);
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
|
||||
var sbx = {
|
||||
properties: {
|
||||
@@ -21,14 +21,14 @@ describe('IOB', function() {
|
||||
}
|
||||
};
|
||||
|
||||
iob.alexa.intentHandlers.length.should.equal(1);
|
||||
iob.alexa.rollupHandlers.length.should.equal(1);
|
||||
iob.virtAsst.intentHandlers.length.should.equal(1);
|
||||
iob.virtAsst.rollupHandlers.length.should.equal(1);
|
||||
|
||||
iob.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
iob.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Current IOB');
|
||||
response.should.equal('You have 1.50 units of insulin on board');
|
||||
|
||||
iob.alexa.rollupHandlers[0].rollupHandler([], sbx, function callback (err, response) {
|
||||
iob.virtAsst.rollupHandlers[0].rollupHandler([], sbx, function callback (err, response) {
|
||||
should.not.exist(err);
|
||||
response.results.should.equal('and you have 1.50 units of insulin on board.');
|
||||
response.priority.should.equal(2);
|
||||
|
||||
+5
-5
@@ -244,7 +244,7 @@ describe('loop', function ( ) {
|
||||
done();
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
var ctx = {
|
||||
settings: {
|
||||
units: 'mg/dl'
|
||||
@@ -256,14 +256,14 @@ describe('loop', function ( ) {
|
||||
var sbx = sandbox.clientInit(ctx, now.valueOf(), {devicestatus: statuses});
|
||||
loop.setProperties(sbx);
|
||||
|
||||
loop.alexa.intentHandlers.length.should.equal(2);
|
||||
loop.virtAsst.intentHandlers.length.should.equal(2);
|
||||
|
||||
loop.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
loop.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Loop Forecast');
|
||||
response.should.equal('According to the loop forecast you are expected to be between 147 and 149 over the next in 25 minutes');
|
||||
|
||||
loop.alexa.intentHandlers[1].intentHandler(function next(title, response) {
|
||||
title.should.equal('Last loop');
|
||||
loop.virtAsst.intentHandlers[1].intentHandler(function next(title, response) {
|
||||
title.should.equal('Last Loop');
|
||||
response.should.equal('The last successful loop was a few seconds ago');
|
||||
done();
|
||||
}, [], sbx);
|
||||
|
||||
@@ -371,7 +371,7 @@ describe('openaps', function ( ) {
|
||||
done();
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
var ctx = {
|
||||
settings: {
|
||||
units: 'mg/dl'
|
||||
@@ -383,14 +383,14 @@ describe('openaps', function ( ) {
|
||||
var sbx = sandbox.clientInit(ctx, now.valueOf(), {devicestatus: statuses});
|
||||
openaps.setProperties(sbx);
|
||||
|
||||
openaps.alexa.intentHandlers.length.should.equal(2);
|
||||
openaps.virtAsst.intentHandlers.length.should.equal(2);
|
||||
|
||||
openaps.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Loop Forecast');
|
||||
openaps.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('OpenAPS Forecast');
|
||||
response.should.equal('The OpenAPS Eventual BG is 125');
|
||||
|
||||
openaps.alexa.intentHandlers[1].intentHandler(function next(title, response) {
|
||||
title.should.equal('Last loop');
|
||||
openaps.virtAsst.intentHandlers[1].intentHandler(function next(title, response) {
|
||||
title.should.equal('Last Loop');
|
||||
response.should.equal('The last successful loop was 2 minutes ago');
|
||||
done();
|
||||
}, [], sbx);
|
||||
|
||||
+19
-7
@@ -255,7 +255,7 @@ describe('pump', function ( ) {
|
||||
done();
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
var ctx = {
|
||||
settings: {
|
||||
units: 'mg/dl'
|
||||
@@ -267,16 +267,28 @@ describe('pump', function ( ) {
|
||||
var sbx = sandbox.clientInit(ctx, now.valueOf(), {devicestatus: statuses});
|
||||
pump.setProperties(sbx);
|
||||
|
||||
pump.alexa.intentHandlers.length.should.equal(2);
|
||||
pump.virtAsst.intentHandlers.length.should.equal(4);
|
||||
|
||||
pump.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Remaining insulin');
|
||||
pump.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Insulin Remaining');
|
||||
response.should.equal('You have 86.4 units remaining');
|
||||
|
||||
pump.alexa.intentHandlers[1].intentHandler(function next(title, response) {
|
||||
title.should.equal('Pump battery');
|
||||
pump.virtAsst.intentHandlers[1].intentHandler(function next(title, response) {
|
||||
title.should.equal('Pump Battery');
|
||||
response.should.equal('Your pump battery is at 1.52 volts');
|
||||
done();
|
||||
|
||||
pump.virtAsst.intentHandlers[2].intentHandler(function next(title, response) {
|
||||
title.should.equal('Insulin Remaining');
|
||||
response.should.equal('You have 86.4 units remaining');
|
||||
|
||||
pump.virtAsst.intentHandlers[3].intentHandler(function next(title, response) {
|
||||
title.should.equal('Pump Battery');
|
||||
response.should.equal('Your pump battery is at 1.52 volts');
|
||||
done();
|
||||
}, [], sbx);
|
||||
|
||||
}, [], sbx);
|
||||
|
||||
}, [], sbx);
|
||||
|
||||
}, [], sbx);
|
||||
|
||||
+3
-3
@@ -35,16 +35,16 @@ describe('Raw BG', function ( ) {
|
||||
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
|
||||
var sandbox = require('../lib/sandbox')();
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
|
||||
rawbg.setProperties(sbx);
|
||||
|
||||
rawbg.alexa.intentHandlers.length.should.equal(1);
|
||||
rawbg.virtAsst.intentHandlers.length.should.equal(1);
|
||||
|
||||
rawbg.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
rawbg.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Current Raw BG');
|
||||
response.should.equal('Your raw bg is 113');
|
||||
|
||||
|
||||
+11
-5
@@ -93,7 +93,7 @@ describe('Uploader Battery', function ( ) {
|
||||
upbat.updateVisualisation(sbx);
|
||||
});
|
||||
|
||||
it('should handle alexa requests', function (done) {
|
||||
it('should handle virtAsst requests', function (done) {
|
||||
|
||||
var ctx = {
|
||||
settings: {}
|
||||
@@ -106,13 +106,19 @@ describe('Uploader Battery', function ( ) {
|
||||
var upbat = require('../lib/plugins/upbat')(ctx);
|
||||
upbat.setProperties(sbx);
|
||||
|
||||
upbat.alexa.intentHandlers.length.should.equal(1);
|
||||
upbat.virtAsst.intentHandlers.length.should.equal(2);
|
||||
|
||||
upbat.alexa.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Uploader battery');
|
||||
upbat.virtAsst.intentHandlers[0].intentHandler(function next(title, response) {
|
||||
title.should.equal('Uploader Battery');
|
||||
response.should.equal('Your uploader battery is at 20%');
|
||||
|
||||
upbat.virtAsst.intentHandlers[1].intentHandler(function next(title, response) {
|
||||
title.should.equal('Uploader Battery');
|
||||
response.should.equal('Your uploader battery is at 20%');
|
||||
|
||||
done();
|
||||
done();
|
||||
}, [], sbx);
|
||||
|
||||
}, [], sbx);
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user