@@ -55,6 +55,14 @@ describe('openBCIUtilities', function () {
55
55
56
56
expect ( sample . sampleNumber ) . to . equal ( 0x45 ) ;
57
57
} ) ;
58
+ it ( 'should be valid' , function ( ) {
59
+ let sample = openBCIUtilities . parsePacketStandardAccel ( {
60
+ rawDataPacket : sampleBuf ,
61
+ channelSettings : defaultChannelSettingsArray ,
62
+ scale : true
63
+ } ) ;
64
+ expect ( sample . valid ) . to . be . true ( ) ;
65
+ } ) ;
58
66
it ( 'all the channels should have the same number value as their (index + 1) * scaleFactor' , function ( ) {
59
67
// sampleBuf has its channel number for each 3 byte integer. See line 20...
60
68
let sample = openBCIUtilities . parsePacketStandardAccel ( {
@@ -138,6 +146,23 @@ describe('openBCIUtilities', function () {
138
146
samplesReceived ++ ;
139
147
}
140
148
} ) ;
149
+ it ( 'should be have time stamp when none given' , function ( ) {
150
+ let sample = openBCIUtilities . parsePacketStandardAccel ( {
151
+ rawDataPacket : sampleBuf ,
152
+ channelSettings : defaultChannelSettingsArray ,
153
+ scale : true
154
+ } ) ;
155
+ expect ( sample . boardTime ) . to . equal ( 0 ) ;
156
+ expect ( sample . timestamp ) . to . be . greaterThan ( 0 ) ;
157
+ } ) ;
158
+ it ( 'should be valid' , function ( ) {
159
+ let sample = openBCIUtilities . parsePacketStandardAccel ( {
160
+ rawDataPacket : sampleBuf ,
161
+ channelSettings : defaultChannelSettingsArray ,
162
+ scale : true
163
+ } ) ;
164
+ expect ( sample . valid ) . to . be . true ( ) ;
165
+ } ) ;
141
166
it ( 'has the right sample number' , function ( ) {
142
167
let expectedSampleNumber = 0x45 ;
143
168
let sample = openBCIUtilities . parsePacketStandardAccel ( {
@@ -246,6 +271,25 @@ describe('openBCIUtilities', function () {
246
271
} ) ;
247
272
expect ( sample . sampleNumber ) . to . equal ( expectedSampleNumber ) ;
248
273
} ) ;
274
+ it ( 'should be valid' , function ( ) {
275
+ packet = openBCIUtilities . samplePacketStandardRawAux ( 0 ) ;
276
+ let sample = openBCIUtilities . parsePacketStandardRawAux ( {
277
+ rawDataPacket : packet ,
278
+ channelSettings : defaultChannelSettingsArray ,
279
+ scale : true
280
+ } ) ;
281
+ expect ( sample . valid ) . to . be . true ( ) ;
282
+ } ) ;
283
+ it ( 'should be have time stamp when none given' , function ( ) {
284
+ packet = openBCIUtilities . samplePacketStandardRawAux ( 0 ) ;
285
+ let sample = openBCIUtilities . parsePacketStandardRawAux ( {
286
+ rawDataPacket : packet ,
287
+ channelSettings : defaultChannelSettingsArray ,
288
+ scale : true
289
+ } ) ;
290
+ expect ( sample . boardTime ) . to . equal ( 0 ) ;
291
+ expect ( sample . timestamp ) . to . be . greaterThan ( 0 ) ;
292
+ } ) ;
249
293
it ( 'has the right stop byte' , function ( ) {
250
294
packet = openBCIUtilities . samplePacketStandardRawAux ( 0 ) ;
251
295
let sample = openBCIUtilities . parsePacketStandardRawAux ( {
@@ -423,6 +467,25 @@ describe('openBCIUtilities', function () {
423
467
expect ( channelValue ) . to . equal ( index + 1 ) ;
424
468
} ) ;
425
469
} ) ;
470
+ it ( 'should be have time stamp when none given' , function ( ) {
471
+ packet1 = openBCIUtilities . samplePacketAccelTimeSynced ( 0 ) ;
472
+ let sample = openBCIUtilities . parsePacketTimeSyncedAccel ( {
473
+ rawDataPacket : packet1 ,
474
+ channelSettings : defaultChannelSettingsArray ,
475
+ scale : true
476
+ } ) ;
477
+ expect ( sample . boardTime ) . to . equal ( 1 ) ;
478
+ expect ( sample . timestamp ) . to . be . greaterThan ( 0 ) ;
479
+ } ) ;
480
+ it ( 'should be valid' , function ( ) {
481
+ packet1 = openBCIUtilities . samplePacketAccelTimeSynced ( 0 ) ;
482
+ let sample = openBCIUtilities . parsePacketTimeSyncedAccel ( {
483
+ rawDataPacket : packet1 ,
484
+ channelSettings : defaultChannelSettingsArray ,
485
+ scale : true
486
+ } ) ;
487
+ expect ( sample . valid ) . to . be . true ( ) ;
488
+ } ) ;
426
489
it ( 'has the right sample number' , function ( ) {
427
490
let expectedSampleNumber = 69 ;
428
491
packet1 = openBCIUtilities . samplePacketAccelTimeSynced ( expectedSampleNumber ) ;
@@ -519,6 +582,25 @@ describe('openBCIUtilities', function () {
519
582
expect ( channelValue ) . to . equal ( index + 1 ) ;
520
583
} ) ;
521
584
} ) ;
585
+ it ( 'should be valid' , function ( ) {
586
+ packet = openBCIUtilities . samplePacketRawAuxTimeSynced ( 0 ) ;
587
+ let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
588
+ rawDataPacket : packet ,
589
+ channelSettings : defaultChannelSettingsArray ,
590
+ scale : true
591
+ } ) ;
592
+ expect ( sample . valid ) . to . be . true ( ) ;
593
+ } ) ;
594
+ it ( 'should be have time stamp when none given' , function ( ) {
595
+ packet = openBCIUtilities . samplePacketRawAuxTimeSynced ( 0 ) ;
596
+ let sample = openBCIUtilities . parsePacketTimeSyncedRawAux ( {
597
+ rawDataPacket : packet ,
598
+ channelSettings : defaultChannelSettingsArray ,
599
+ scale : true
600
+ } ) ;
601
+ expect ( sample . boardTime ) . to . equal ( 1 ) ;
602
+ expect ( sample . timestamp ) . to . be . greaterThan ( 0 ) ;
603
+ } ) ;
522
604
it ( 'has the right sample number' , function ( ) {
523
605
let expectedSampleNumber = 69 ;
524
606
packet = openBCIUtilities . samplePacketRawAuxTimeSynced ( expectedSampleNumber ) ;
@@ -689,8 +771,8 @@ describe('openBCIUtilities', function () {
689
771
timeOffset : timeOffset ,
690
772
accelArray
691
773
} ) ;
692
- expect ( sample . timeStamp ) . to . exist ( ) ;
693
- expect ( sample . timeStamp ) . to . equal ( time + timeOffset ) ;
774
+ expect ( sample . timestamp ) . to . exist ( ) ;
775
+ expect ( sample . timestamp ) . to . equal ( time + timeOffset ) ;
694
776
} ) ;
695
777
} ) ;
696
778
describe ( '#convertSampleToPacketRawAuxTimeSynced' , function ( ) {
@@ -755,8 +837,8 @@ describe('openBCIUtilities', function () {
755
837
timeOffset : timeOffset ,
756
838
scale : false
757
839
} ) ;
758
- expect ( sample . timeStamp ) . to . exist ( ) ;
759
- expect ( sample . timeStamp ) . to . equal ( time + timeOffset ) ;
840
+ expect ( sample . timestamp ) . to . exist ( ) ;
841
+ expect ( sample . timestamp ) . to . equal ( time + timeOffset ) ;
760
842
} ) ;
761
843
} ) ;
762
844
describe ( '#interpret24bitAsInt32' , function ( ) {
@@ -947,6 +1029,10 @@ describe('openBCIUtilities', function () {
947
1029
// Call the function under test
948
1030
daisySampleObjectNoScale = openBCIUtilities . makeDaisySampleObject ( lowerSampleObjectNoScale , upperSampleObjectNoScale ) ;
949
1031
} ) ;
1032
+ it ( 'should have valid object true' , function ( ) {
1033
+ expect ( daisySampleObject . valid ) . to . be . true ( ) ;
1034
+ expect ( daisySampleObjectNoScale . valid ) . to . be . true ( ) ;
1035
+ } ) ;
950
1036
it ( 'should make a channelData array 16 elements long' , function ( ) {
951
1037
expect ( daisySampleObject . channelData ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
952
1038
expect ( daisySampleObjectNoScale . channelDataCounts ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
@@ -1024,6 +1110,10 @@ describe('openBCIUtilities', function () {
1024
1110
// Call the function under test
1025
1111
daisySampleObjectNoScale = openBCIUtilities . makeDaisySampleObjectWifi ( lowerSampleObjectNoScale , upperSampleObjectNoScale ) ;
1026
1112
} ) ;
1113
+ it ( 'should have valid object true' , function ( ) {
1114
+ expect ( daisySampleObject . valid ) . to . be . true ( ) ;
1115
+ expect ( daisySampleObjectNoScale . valid ) . to . be . true ( ) ;
1116
+ } ) ;
1027
1117
it ( 'should make a channelData array 16 elements long' , function ( ) {
1028
1118
expect ( daisySampleObject . channelData ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
1029
1119
expect ( daisySampleObjectNoScale . channelDataCounts ) . to . have . length ( k . OBCINumberOfChannelsDaisy ) ;
0 commit comments