@@ -78,7 +78,7 @@ describe('determine-basal', function ( ) {
7878 //function determine_basal(glucose_status, currenttemp, iob_data, profile)
7979
8080 // standard initial conditions for all determine-basal test cases unless overridden
81- var glucose_status = { "delta" :0 , "glucose" :115 , "long_avgdelta" :0 .1, "short_avgdelta" :0 } ;
81+ var glucose_status = { "delta" :0 , "glucose" :115 , "long_avgdelta" :1 .1, "short_avgdelta" :0 } ;
8282 var currenttemp = { "duration" :0 , "rate" :0 , "temp" :"absolute" } ;
8383 var iob_data = { "iob" :0 , "activity" :0 , "bolussnooze" :0 } ;
8484 var autosens = { "ratio" :1.0 } ;
@@ -126,7 +126,7 @@ describe('determine-basal', function ( ) {
126126 it ( 'should do nothing when low and rising w/o IOB' , function ( ) {
127127 var glucose_status = { "delta" :6 , "glucose" :75 , "long_avgdelta" :6 , "short_avgdelta" :6 } ;
128128 var output = determine_basal ( glucose_status , currenttemp , iob_data , profile , autosens , meal_data , tempBasalFunctions ) ;
129- console . log ( output ) ;
129+ // console.log(output);
130130 output . rate . should . equal ( 0.9 ) ;
131131 output . duration . should . equal ( 30 ) ;
132132 //output.reason.should.match(/75<80.*setting current basal/);
@@ -248,27 +248,30 @@ describe('determine-basal', function ( ) {
248248 } ) ;
249249
250250 it ( 'should temp to 0 when LOW w/ positive IOB' , function ( ) {
251- var glucose_status = { "delta" :0 , "glucose" :39 , "long_avgdelta" :0 .1, "short_avgdelta" :0 } ;
251+ var glucose_status = { "delta" :0 , "glucose" :39 , "long_avgdelta" :- 1 .1, "short_avgdelta" :0 } ;
252252 var iob_data = { "iob" :1 , "activity" :0.01 , "bolussnooze" :0.5 } ;
253253 var output = determine_basal ( glucose_status , currenttemp , iob_data , profile , autosens , meal_data , tempBasalFunctions ) ;
254+ //console.log(output);
254255 output . rate . should . equal ( 0 ) ;
255256 output . duration . should . be . above ( 29 ) ;
256257 //output.reason.should.match(/BG 39<80/);
257258 } ) ;
258259
259260 it ( 'should low temp when LOW w/ negative IOB' , function ( ) {
260- var glucose_status = { "delta" :0 , "glucose" :39 , "long_avgdelta" :0 .1, "short_avgdelta" :0 } ;
261+ var glucose_status = { "delta" :0 , "glucose" :39 , "long_avgdelta" :- 1 .1, "short_avgdelta" :0 } ;
261262 var iob_data = { "iob" :- 2.5 , "activity" :- 0.03 , "bolussnooze" :0 } ;
262263 var output = determine_basal ( glucose_status , currenttemp , iob_data , profile , autosens , meal_data , tempBasalFunctions ) ;
264+ //console.log(output);
263265 output . rate . should . be . below ( 0.8 ) ;
264266 output . duration . should . be . above ( 29 ) ;
265267 //output.reason.should.match(/BG 39<80/);
266268 } ) ;
267269
268270 it ( 'should temp to 0 when LOW w/ no IOB' , function ( ) {
269- var glucose_status = { "delta" :0 , "glucose" :39 , "long_avgdelta" :0 .1, "short_avgdelta" :0 } ;
271+ var glucose_status = { "delta" :0 , "glucose" :39 , "long_avgdelta" :- 1 .1, "short_avgdelta" :0 } ;
270272 var iob_data = { "iob" :0 , "activity" :0 , "bolussnooze" :0 } ;
271273 var output = determine_basal ( glucose_status , currenttemp , iob_data , profile , autosens , meal_data , tempBasalFunctions ) ;
274+ //console.log(output);
272275 output . rate . should . equal ( 0 ) ;
273276 output . duration . should . be . above ( 29 ) ;
274277 //output.reason.should.match(/BG 39<80/);
@@ -476,7 +479,7 @@ describe('determine-basal', function ( ) {
476479 var output = determine_basal ( { glucose :10 } , currenttemp , iob_data , profile , autosens , meal_data , tempBasalFunctions ) ;
477480 //console.log(output);
478481 output . rate . should . be . below ( 1 ) ;
479- output . reason . should . match ( / C a n c e l i n g h i g h t e m p / ) ;
482+ output . reason . should . match ( / R e p l a c i n g h i g h t e m p / ) ;
480483 } ) ;
481484
482485 it ( 'profile should contain min_bg,max_bg' , function ( ) {
@@ -725,6 +728,7 @@ describe('determine-basal', function ( ) {
725728 profile . current_basal = 0.825 ;
726729 profile . model = "523" ;
727730 var output = determine_basal ( glucose_status , currenttemp , iob_data , profile , autosens , meal_data , tempBasalFunctions ) ;
731+ //console.log(output);
728732 //output.rate.should.equal(0);
729733 //output.duration.should.equal(0);
730734 output . rate . should . equal ( 0.825 ) ;
@@ -738,6 +742,7 @@ describe('determine-basal', function ( ) {
738742 profile . current_basal = 0.875 ;
739743 profile . model = "522" ;
740744 var output = determine_basal ( glucose_status , currenttemp , iob_data , profile , autosens , meal_data , tempBasalFunctions ) ;
745+ //console.log(output);
741746 //output.rate.should.equal(0);
742747 //output.duration.should.equal(0);
743748 output . rate . should . equal ( 0.9 ) ;
0 commit comments