@@ -972,17 +972,18 @@ describe('DataUtil', () => {
972972 it ( 'should add the datum to the `bolusDosingDecisionDatumsByIdMap`' , ( ) => {
973973 dataUtil . validateDatumIn = sinon . stub ( ) . returns ( true ) ;
974974
975- const acceptableReasons = [ 'normalBolus' , 'simpleBolus' , 'watchBolus' ] ;
976- const dosingDecisionReasons = [ 'loop' , 'normalBolus' , 'simpleBolus' , 'watchBolus' ] ;
975+ const acceptableReasons = [ 'normalBolus' , 'simpleBolus' , 'watchBolus' , 'oneButtonBolus' ] ;
976+ const dosingDecisionReasons = [ 'loop' , 'normalBolus' , 'simpleBolus' , 'watchBolus' , 'oneButtonBolus' ] ;
977977 _ . each ( dosingDecisionReasons , ( reason , index ) => {
978978 dataUtil . normalizeDatumIn ( { type : 'dosingDecision' , id : `ID${ index } ` , reason } ) ;
979979 } ) ;
980980
981981 // the 'loop' reason datum should not be added
982- expect ( _ . keys ( dataUtil . bolusDosingDecisionDatumsByIdMap ) ) . to . have . lengthOf ( 3 ) ;
982+ expect ( _ . keys ( dataUtil . bolusDosingDecisionDatumsByIdMap ) ) . to . have . lengthOf ( 4 ) ;
983983 expect ( dataUtil . bolusDosingDecisionDatumsByIdMap . ID1 . reason ) . to . eql ( acceptableReasons [ 0 ] ) ;
984984 expect ( dataUtil . bolusDosingDecisionDatumsByIdMap . ID2 . reason ) . to . eql ( acceptableReasons [ 1 ] ) ;
985985 expect ( dataUtil . bolusDosingDecisionDatumsByIdMap . ID3 . reason ) . to . eql ( acceptableReasons [ 2 ] ) ;
986+ expect ( dataUtil . bolusDosingDecisionDatumsByIdMap . ID4 . reason ) . to . eql ( acceptableReasons [ 3 ] ) ;
986987 } ) ;
987988 } ) ;
988989
@@ -1050,7 +1051,7 @@ describe('DataUtil', () => {
10501051 time : Date . parse ( '2024-02-02T10:05:00.000Z' ) ,
10511052 origin : { name : 'org.tidepool.Loop' } ,
10521053 associations : [ { reason : 'pumpSettings' , id : 'pumpSettings1' } ] ,
1053- requestedBolus : { amount : 12 } ,
1054+ requestedBolus : { normal : 12 } ,
10541055 insulinOnBoard : { amount : 4 } ,
10551056 food : { nutrition : { carbohydrate : { net : 30 } } } ,
10561057 bgHistorical : [
@@ -2016,6 +2017,13 @@ describe('DataUtil', () => {
20162017 sinon . assert . calledWithMatch ( dataUtil . normalizeDatumBgUnits , datum , [ 'bgForecast' ] , [ 'value' ] ) ;
20172018 } ) ;
20182019
2020+ it ( 'should call `normalizeDatumBgUnits` on bgHistorical field objects' , ( ) => {
2021+ sinon . spy ( dataUtil , 'normalizeDatumBgUnits' ) ;
2022+ const datum = { type : 'dosingDecision' } ;
2023+ dataUtil . normalizeDatumOut ( datum ) ;
2024+ sinon . assert . calledWithMatch ( dataUtil . normalizeDatumBgUnits , datum , [ 'bgHistorical' ] , [ 'value' ] ) ;
2025+ } ) ;
2026+
20192027 it ( 'should call `normalizeDatumBgUnits` on smbg field objects' , ( ) => {
20202028 sinon . spy ( dataUtil , 'normalizeDatumBgUnits' ) ;
20212029 const datum = { type : 'dosingDecision' } ;
0 commit comments