mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
fix/cleanup test
This commit is contained in:
@@ -36,9 +36,6 @@ describe('Treatment API', function ( ) {
|
||||
should.not.exist(self.ctx.ddata.treatments[0].notes);
|
||||
|
||||
should.not.exist(self.ctx.ddata.treatments[1].eventTime);
|
||||
should.not.exist(self.ctx.ddata.treatments[1].glucose);
|
||||
should.not.exist(self.ctx.ddata.treatments[1].glucoseType);
|
||||
should.not.exist(self.ctx.ddata.treatments[1].units);
|
||||
self.ctx.ddata.treatments[1].insulin.should.equal(2);
|
||||
self.ctx.ddata.treatments[2].carbs.should.equal(30);
|
||||
|
||||
@@ -63,7 +60,7 @@ describe('Treatment API', function ( ) {
|
||||
request(self.app)
|
||||
.post('/api/treatments/')
|
||||
.set('api-secret', self.env.api_secret || '')
|
||||
.send({eventType: 'Meal Bolus', carbs: '30', insulin: '2.00', preBolus: '15', glucoseType: 'Finger', units: 'mg/dl'})
|
||||
.send({eventType: 'Meal Bolus', carbs: '30', insulin: '2.00', preBolus: '15', glucose: 100, glucoseType: 'Finger', units: 'mg/dl'})
|
||||
.expect(200)
|
||||
.end(function (err) {
|
||||
if (err) {
|
||||
@@ -78,15 +75,13 @@ describe('Treatment API', function ( ) {
|
||||
var doneCalled = false;
|
||||
|
||||
self.ctx.bus.on('data-loaded', function dataWasLoaded ( ) {
|
||||
console.info('>>>self.ctx.ddata.treatments', self.ctx.ddata.treatments);
|
||||
self.ctx.ddata.treatments.length.should.equal(3);
|
||||
self.ctx.ddata.treatments[0].mgdl.should.equal(100);
|
||||
should.not.exist(self.ctx.ddata.treatments[0].eventTime);
|
||||
should.not.exist(self.ctx.ddata.treatments[0].notes);
|
||||
|
||||
should.not.exist(self.ctx.ddata.treatments[1].eventTime);
|
||||
should.not.exist(self.ctx.ddata.treatments[1].glucose);
|
||||
should.not.exist(self.ctx.ddata.treatments[1].glucoseType);
|
||||
should.not.exist(self.ctx.ddata.treatments[1].units);
|
||||
self.ctx.ddata.treatments[1].insulin.should.equal(2);
|
||||
self.ctx.ddata.treatments[2].carbs.should.equal(30);
|
||||
|
||||
@@ -102,7 +97,7 @@ describe('Treatment API', function ( ) {
|
||||
.set('api-secret', self.env.api_secret || '')
|
||||
.send([
|
||||
{eventType: 'BG Check', glucose: 100, preBolus: '0', glucoseType: 'Finger', units: 'mg/dl', notes: ''}
|
||||
, {eventType: 'Meal Bolus', carbs: '30', insulin: '2.00', preBolus: '15', glucoseType: 'Finger', units: 'mg/dl'}
|
||||
, {eventType: 'Meal Bolus', carbs: '30', insulin: '2.00', preBolus: '15', glucose: 100, glucoseType: 'Finger', units: 'mg/dl'}
|
||||
])
|
||||
.expect(200)
|
||||
.end(function (err) {
|
||||
@@ -132,15 +127,15 @@ describe('Treatment API', function ( ) {
|
||||
.post('/api/treatments/')
|
||||
.set('api-secret', self.env.api_secret || '')
|
||||
.send([
|
||||
{eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, created_at: now}
|
||||
, {eventType: 'Meal Bolus', carbs: '30', insulin: '2.00', preBolus: '15', glucoseType: 'Finger', units: 'mg/dl'}
|
||||
{eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'BG Check', glucose: 100, units: 'mg/dl', created_at: now}
|
||||
, {eventType: 'Meal Bolus', carbs: '30', insulin: '2.00', preBolus: '15', glucose: 100, glucoseType: 'Finger', units: 'mg/dl'}
|
||||
])
|
||||
.expect(200)
|
||||
.end(function (err) {
|
||||
|
||||
@@ -144,7 +144,6 @@ describe('IOB', function() {
|
||||
|
||||
it('should fall back to treatments if openaps devicestatus is present but too stale', function() {
|
||||
var devicestatus = [_.merge(OPENAPS_DEVICESTATUS, { mills: time - iob.RECENCY_THRESHOLD - 1, openaps: {iob: {timestamp: time - iob.RECENCY_THRESHOLD - 1} } })];
|
||||
console.info('>>>devicestatus', devicestatus);
|
||||
iob.calcTotal(treatments, devicestatus, profile, time).should.containEql({
|
||||
source: 'Care Portal',
|
||||
iob: treatmentIOB
|
||||
|
||||
Reference in New Issue
Block a user