@@ -917,6 +917,7 @@ describe('openBCIUtilities', function () {
917917 } ) ;
918918 describe ( '#makeDaisySampleObject' , function ( ) {
919919 let lowerSampleObject , upperSampleObject , daisySampleObject ;
920+ let lowerSampleObjectNoScale , upperSampleObjectNoScale , daisySampleObjectNoScale ;
920921 before ( ( ) => {
921922 // Make the lower sample (channels 1-8)
922923 lowerSampleObject = openBCIUtilities . newSample ( 1 ) ;
@@ -931,38 +932,63 @@ describe('openBCIUtilities', function () {
931932 upperSampleObject . timestamp = 8 ;
932933
933934 daisySampleObject = openBCIUtilities . makeDaisySampleObject ( lowerSampleObject , upperSampleObject ) ;
935+
936+ lowerSampleObjectNoScale = openBCIUtilities . newSample ( 1 ) ;
937+ lowerSampleObjectNoScale . channelDataCounts = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] ;
938+ lowerSampleObjectNoScale . auxData = [ 0 , 1 , 2 ] ;
939+ lowerSampleObjectNoScale . timestamp = 4 ;
940+ lowerSampleObjectNoScale . accelData = [ 0.5 , - 0.5 , 1 ] ;
941+ // Make the upper sample (channels 9-16)
942+ upperSampleObjectNoScale = openBCIUtilities . newSample ( 2 ) ;
943+ upperSampleObjectNoScale . channelDataCounts = [ 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 ] ;
944+ upperSampleObjectNoScale . auxData = [ 3 , 4 , 5 ] ;
945+ upperSampleObjectNoScale . timestamp = 8 ;
946+
947+ // Call the function under test
948+ daisySampleObjectNoScale = openBCIUtilities . makeDaisySampleObject ( lowerSampleObjectNoScale , upperSampleObjectNoScale ) ;
934949 } ) ;
935950 it ( 'should make a channelData array 16 elements long' , function ( ) {
936951 expect ( daisySampleObject . channelData ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
952+ expect ( daisySampleObjectNoScale . channelDataCounts ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
937953 } ) ;
938954 it ( 'should make a channelData array with lower array in front of upper array' , function ( ) {
939955 for ( let i = 0 ; i < 16 ; i ++ ) {
940956 expect ( daisySampleObject . channelData [ i ] ) . to . equal ( i + 1 ) ;
957+ expect ( daisySampleObjectNoScale . channelDataCounts [ i ] ) . to . equal ( i + 1 ) ;
941958 }
942959 } ) ;
943960 it ( 'should make the sample number equal to the second packet divided by two' , function ( ) {
944961 expect ( daisySampleObject . sampleNumber ) . to . equal ( upperSampleObject . sampleNumber / 2 ) ;
962+ expect ( daisySampleObjectNoScale . sampleNumber ) . to . equal ( upperSampleObjectNoScale . sampleNumber / 2 ) ;
945963 } ) ;
946964 it ( 'should put the aux packets in an object' , function ( ) {
947965 expect ( daisySampleObject . auxData ) . to . have . property ( 'lower' ) ;
948966 expect ( daisySampleObject . auxData ) . to . have . property ( 'upper' ) ;
967+ expect ( daisySampleObjectNoScale . auxData ) . to . have . property ( 'lower' ) ;
968+ expect ( daisySampleObjectNoScale . auxData ) . to . have . property ( 'upper' ) ;
949969 } ) ;
950970 it ( 'should put the aux packets in an object in the right order' , function ( ) {
951971 for ( let i = 0 ; i < 3 ; i ++ ) {
952972 expect ( daisySampleObject . auxData [ 'lower' ] [ i ] ) . to . equal ( i ) ;
953973 expect ( daisySampleObject . auxData [ 'upper' ] [ i ] ) . to . equal ( i + 3 ) ;
974+ expect ( daisySampleObjectNoScale . auxData [ 'lower' ] [ i ] ) . to . equal ( i ) ;
975+ expect ( daisySampleObjectNoScale . auxData [ 'upper' ] [ i ] ) . to . equal ( i + 3 ) ;
954976 }
955977 } ) ;
956978 it ( 'should average the two timestamps together' , function ( ) {
957979 let expectedAverage = ( upperSampleObject . timestamp + lowerSampleObject . timestamp ) / 2 ;
958980 expect ( daisySampleObject . timestamp ) . to . equal ( expectedAverage ) ;
981+ expect ( daisySampleObjectNoScale . timestamp ) . to . equal ( expectedAverage ) ;
959982 } ) ;
960983 it ( 'should place the old timestamps in an object' , function ( ) {
961984 expect ( daisySampleObject . _timestamps . lower ) . to . equal ( lowerSampleObject . timestamp ) ;
962985 expect ( daisySampleObject . _timestamps . upper ) . to . equal ( upperSampleObject . timestamp ) ;
986+ expect ( daisySampleObjectNoScale . _timestamps . lower ) . to . equal ( lowerSampleObjectNoScale . timestamp ) ;
987+ expect ( daisySampleObjectNoScale . _timestamps . upper ) . to . equal ( upperSampleObjectNoScale . timestamp ) ;
963988 } ) ;
964989 it ( 'should store an accelerometer value if present' , function ( ) {
965990 expect ( daisySampleObject ) . to . have . property ( 'accelData' ) ;
991+ expect ( daisySampleObjectNoScale ) . to . have . property ( 'accelData' ) ;
966992 } ) ;
967993 } ) ;
968994
0 commit comments