mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Server-side localization fixes, better speech api use (#3724)
* Adds API to plugin manager that calls plugins to visualize alarms * Refactoring how the translation object is managed after discovering every server-side plugin had it's own instance of the translations and the language code wasn't propagated to any code that generated alarms * Add more missing translations * Some more localization fixes Update Finnish to 100% localized Change Mongo connection to not stop retrying connecting * Better scaling for mmol Fix bug in detecting new BG values * Delta calculation was the wrong way round :D * add missing dutch translations * Have tests bail early & tell Mocha to exit at the end of the run * Try if Travis likes running tests one by one better * Enable blocking IO for Travis
This commit is contained in:
@@ -13,6 +13,7 @@ describe('ar2', function ( ) {
|
||||
};
|
||||
ctx.ddata = require('../lib/data/ddata')();
|
||||
ctx.notifications = require('../lib/notifications')(env, ctx);
|
||||
ctx.levels = levels;
|
||||
|
||||
var ar2 = require('../lib/plugins/ar2')(ctx);
|
||||
var bgnow = require('../lib/plugins/bgnow')(ctx);
|
||||
|
||||
@@ -10,6 +10,9 @@ describe('BG Now', function ( ) {
|
||||
var ctx = {
|
||||
language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.levels = require('../lib/levels');
|
||||
|
||||
var bgnow = require('../lib/plugins/bgnow')(ctx);
|
||||
var sandbox = require('../lib/sandbox')();
|
||||
|
||||
@@ -29,6 +32,10 @@ describe('BG Now', function ( ) {
|
||||
, language: { translate: function(text) { return text; } }
|
||||
}
|
||||
};
|
||||
|
||||
ctx.language = ctx.pluginBase.language;
|
||||
ctx.levels = require('../lib/levels');
|
||||
|
||||
var data = {sgvs: [{mills: before, mgdl: 100}, {mills: now, mgdl: 105}]};
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
|
||||
@@ -138,6 +138,9 @@ describe('boluswizardpreview', function ( ) {
|
||||
}
|
||||
, pluginBase: {}
|
||||
};
|
||||
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var data = {sgvs: [{mills: before, mgdl: 100}, {mills: now, mgdl: 100}]};
|
||||
data.treatments = [{mills: now, insulin: '1.0'}];
|
||||
data.devicestatus = [];
|
||||
@@ -178,6 +181,9 @@ describe('boluswizardpreview', function ( ) {
|
||||
}
|
||||
, pluginBase: {}
|
||||
};
|
||||
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var data = {sgvs: [{mills: before, mgdl: 175}, {mills: now, mgdl: 153}]};
|
||||
data.treatments = [{mills: now, insulin: '0.45'}];
|
||||
data.devicestatus = [];
|
||||
@@ -233,6 +239,7 @@ describe('boluswizardpreview', function ( ) {
|
||||
ctx.ddata.sgvs = [{mills: before, mgdl: 295}, {mills: now, mgdl: 300}];
|
||||
ctx.ddata.treatments = [];
|
||||
ctx.ddata.profiles = [profile];
|
||||
ctx.levels = require('../lib/levels');
|
||||
|
||||
var sbx = prepareSandbox();
|
||||
boluswizardpreview.checkNotifications(sbx);
|
||||
@@ -278,7 +285,8 @@ describe('boluswizardpreview', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ctx.language = require('../lib/language')();
|
||||
var loadedProfile = require('../lib/profilefunctions')();
|
||||
loadedProfile.loadData([profile]);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ describe('cage', function ( ) {
|
||||
}
|
||||
};
|
||||
|
||||
ctx.language = require('../lib/language')();
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
cage.setProperties(sbx);
|
||||
cage.updateVisualisation(sbx);
|
||||
@@ -65,7 +66,7 @@ describe('cage', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ctx.language = require('../lib/language')();
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
cage.setProperties(sbx);
|
||||
cage.updateVisualisation(sbx);
|
||||
|
||||
@@ -12,6 +12,7 @@ describe('BG direction', function ( ) {
|
||||
, pluginBase: pluginBase || {}
|
||||
};
|
||||
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var sandbox = require('../lib/sandbox')();
|
||||
return sandbox.clientInit(ctx, Date.now(), data);
|
||||
|
||||
@@ -11,6 +11,7 @@ describe('errorcodes', function ( ) {
|
||||
var ctx = {};
|
||||
ctx.ddata = require('../lib/data/ddata')();
|
||||
ctx.notifications = require('../lib/notifications')(env, ctx);
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
|
||||
it('Not trigger an alarm when in range', function (done) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require('should');
|
||||
var levels = require('../lib/levels');
|
||||
|
||||
describe('cage', function ( ) {
|
||||
describe('insulinage', function ( ) {
|
||||
var env = require('../env')();
|
||||
var ctx = {};
|
||||
ctx.ddata = require('../lib/data/ddata')();
|
||||
@@ -39,6 +39,7 @@ describe('cage', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
iage.setProperties(sbx);
|
||||
@@ -65,6 +66,7 @@ describe('cage', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
iage.setProperties(sbx);
|
||||
|
||||
+2
-1
@@ -166,7 +166,8 @@ describe('loop', function ( ) {
|
||||
done();
|
||||
}
|
||||
, language: require('../lib/language')()
|
||||
}
|
||||
},
|
||||
language: require('../lib/language')()
|
||||
};
|
||||
|
||||
var errorTime = moment(statuses[1].created_at);
|
||||
|
||||
@@ -271,6 +271,7 @@ describe('openaps', function ( ) {
|
||||
done();
|
||||
}
|
||||
}
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, now.valueOf(), {devicestatus: statuses});
|
||||
@@ -301,6 +302,7 @@ describe('openaps', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
@@ -328,6 +330,7 @@ describe('openaps', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
@@ -349,7 +352,8 @@ describe('openaps', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
};
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ var env = require('../env')();
|
||||
var pump = require('../lib/plugins/pump')(ctx);
|
||||
var sandbox = require('../lib/sandbox')();
|
||||
var levels = require('../lib/levels');
|
||||
ctx.levels = levels;
|
||||
|
||||
var statuses = [{
|
||||
created_at: '2015-12-05T17:35:00.000Z'
|
||||
@@ -67,6 +68,7 @@ describe('pump', function ( ) {
|
||||
done();
|
||||
}
|
||||
}
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, now.valueOf(), {devicestatus: statuses});
|
||||
@@ -97,6 +99,7 @@ describe('pump', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
@@ -120,6 +123,7 @@ describe('pump', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
@@ -147,6 +151,7 @@ describe('pump', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
@@ -175,6 +180,7 @@ describe('pump', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
@@ -202,6 +208,7 @@ describe('pump', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
@@ -229,6 +236,7 @@ describe('pump', function ( ) {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, notifications: require('../lib/notifications')(env, ctx)
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
|
||||
ctx.notifications.initRequests();
|
||||
|
||||
+3
-7
@@ -4,8 +4,9 @@ require('should');
|
||||
|
||||
describe('Raw BG', function ( ) {
|
||||
var ctx = {
|
||||
settings: {}
|
||||
settings: { units: 'mg/dl'}
|
||||
, language: require('../lib/language')()
|
||||
, pluginBase: {}
|
||||
};
|
||||
ctx.language.set('en');
|
||||
|
||||
@@ -16,12 +17,7 @@ describe('Raw BG', function ( ) {
|
||||
sgvs: [{unfiltered: 113680, filtered: 111232, mgdl: 110, noise: 1, mills: now}]
|
||||
, cals: [{scale: 1, intercept: 25717.82377004309, slope: 766.895601715918, mills: now}]
|
||||
};
|
||||
var ctx = {
|
||||
settings: {
|
||||
units: 'mg/dl'
|
||||
}
|
||||
, pluginBase: {}
|
||||
};
|
||||
|
||||
|
||||
it('should calculate Raw BG', function (done) {
|
||||
var sandbox = require('../lib/sandbox')();
|
||||
|
||||
@@ -18,6 +18,8 @@ describe('sandbox', function ( ) {
|
||||
}
|
||||
, pluginBase: {}
|
||||
};
|
||||
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var data = {sgvs: [{mgdl: 100, mills: now}]};
|
||||
|
||||
@@ -35,6 +37,7 @@ describe('sandbox', function ( ) {
|
||||
var ctx = {};
|
||||
ctx.ddata = require('../lib/data/ddata')();
|
||||
ctx.notifications = require('../lib/notifications')(env, ctx);
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
return sandbox.serverInit(env, ctx);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ describe('sage', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
sage.setProperties(sbx);
|
||||
@@ -71,6 +72,7 @@ describe('sage', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
sage.setProperties(sbx);
|
||||
@@ -98,6 +100,7 @@ describe('sage', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
sage.setProperties(sbx);
|
||||
@@ -127,6 +130,7 @@ describe('sage', function ( ) {
|
||||
}
|
||||
}
|
||||
};
|
||||
ctx.language = require('../lib/language')();
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
sage.setProperties(sbx);
|
||||
|
||||
@@ -10,6 +10,8 @@ describe('treatmentnotify', function ( ) {
|
||||
var ctx = {};
|
||||
ctx.ddata = require('../lib/data/ddata')();
|
||||
ctx.notifications = require('../lib/notifications')(env, ctx);
|
||||
ctx.levels = levels;
|
||||
ctx.language = require('../lib/language')().set('en');
|
||||
|
||||
var now = Date.now();
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ describe('Uploader Battery', function ( ) {
|
||||
, language: require('../lib/language')()
|
||||
};
|
||||
ctx.language.set('en');
|
||||
ctx.levels = require('../lib/levels');
|
||||
|
||||
var sbx = sandbox.clientInit(ctx, Date.now(), data);
|
||||
|
||||
sbx.offerProperty = function mockedOfferProperty (name, setter) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
var request = require('supertest');
|
||||
var language = require('../lib/language')();
|
||||
require('should');
|
||||
|
||||
describe('verifyauth', function ( ) {
|
||||
var api = require('../lib/api/');
|
||||
|
||||
Reference in New Issue
Block a user