@@ -917,6 +917,7 @@ describe('openBCIUtilities', function () {
917
917
} ) ;
918
918
describe ( '#makeDaisySampleObject' , function ( ) {
919
919
let lowerSampleObject , upperSampleObject , daisySampleObject ;
920
+ let lowerSampleObjectNoScale , upperSampleObjectNoScale , daisySampleObjectNoScale ;
920
921
before ( ( ) => {
921
922
// Make the lower sample (channels 1-8)
922
923
lowerSampleObject = openBCIUtilities . newSample ( 1 ) ;
@@ -931,38 +932,63 @@ describe('openBCIUtilities', function () {
931
932
upperSampleObject . timestamp = 8 ;
932
933
933
934
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 ) ;
934
949
} ) ;
935
950
it ( 'should make a channelData array 16 elements long' , function ( ) {
936
951
expect ( daisySampleObject . channelData ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
952
+ expect ( daisySampleObjectNoScale . channelDataCounts ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
937
953
} ) ;
938
954
it ( 'should make a channelData array with lower array in front of upper array' , function ( ) {
939
955
for ( let i = 0 ; i < 16 ; i ++ ) {
940
956
expect ( daisySampleObject . channelData [ i ] ) . to . equal ( i + 1 ) ;
957
+ expect ( daisySampleObjectNoScale . channelDataCounts [ i ] ) . to . equal ( i + 1 ) ;
941
958
}
942
959
} ) ;
943
960
it ( 'should make the sample number equal to the second packet divided by two' , function ( ) {
944
961
expect ( daisySampleObject . sampleNumber ) . to . equal ( upperSampleObject . sampleNumber / 2 ) ;
962
+ expect ( daisySampleObjectNoScale . sampleNumber ) . to . equal ( upperSampleObjectNoScale . sampleNumber / 2 ) ;
945
963
} ) ;
946
964
it ( 'should put the aux packets in an object' , function ( ) {
947
965
expect ( daisySampleObject . auxData ) . to . have . property ( 'lower' ) ;
948
966
expect ( daisySampleObject . auxData ) . to . have . property ( 'upper' ) ;
967
+ expect ( daisySampleObjectNoScale . auxData ) . to . have . property ( 'lower' ) ;
968
+ expect ( daisySampleObjectNoScale . auxData ) . to . have . property ( 'upper' ) ;
949
969
} ) ;
950
970
it ( 'should put the aux packets in an object in the right order' , function ( ) {
951
971
for ( let i = 0 ; i < 3 ; i ++ ) {
952
972
expect ( daisySampleObject . auxData [ 'lower' ] [ i ] ) . to . equal ( i ) ;
953
973
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 ) ;
954
976
}
955
977
} ) ;
956
978
it ( 'should average the two timestamps together' , function ( ) {
957
979
let expectedAverage = ( upperSampleObject . timestamp + lowerSampleObject . timestamp ) / 2 ;
958
980
expect ( daisySampleObject . timestamp ) . to . equal ( expectedAverage ) ;
981
+ expect ( daisySampleObjectNoScale . timestamp ) . to . equal ( expectedAverage ) ;
959
982
} ) ;
960
983
it ( 'should place the old timestamps in an object' , function ( ) {
961
984
expect ( daisySampleObject . _timestamps . lower ) . to . equal ( lowerSampleObject . timestamp ) ;
962
985
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 ) ;
963
988
} ) ;
964
989
it ( 'should store an accelerometer value if present' , function ( ) {
965
990
expect ( daisySampleObject ) . to . have . property ( 'accelData' ) ;
991
+ expect ( daisySampleObjectNoScale ) . to . have . property ( 'accelData' ) ;
966
992
} ) ;
967
993
} ) ;
968
994
0 commit comments