@@ -1319,33 +1319,51 @@ $$$`);
13191319 expect ( openBCIUtilities . doesBufferHaveEOT ( buf ) ) . to . equal ( true ) ;
13201320 } ) ;
13211321 } ) ;
1322- describe ( '#findV2Firmware ' , function ( ) {
1322+ describe ( '#getMajorFirmwareVersion ' , function ( ) {
13231323 it ( 'should not crash on small buff' , function ( ) {
13241324 let buf = new Buffer ( 'AJ!' ) ;
13251325
1326- expect ( openBCIUtilities . findV2Firmware ( buf ) ) . to . be . false ( ) ;
1326+ expect ( openBCIUtilities . getFirmware ( buf ) ) . to . equal ( null ) ;
13271327 } ) ;
13281328 it ( 'should not find any v2' , function ( ) {
13291329 let buf = new Buffer ( 'AJ Keller is an awesome programmer!\n I know right!' ) ;
13301330
1331- expect ( openBCIUtilities . findV2Firmware ( buf ) ) . to . be . false ( ) ;
1331+ expect ( openBCIUtilities . getFirmware ( buf ) ) . to . equal ( null ) ;
13321332 } ) ;
13331333 it ( 'should not find a v2' , function ( ) {
13341334 let buf = new Buffer ( `OpenBCI V3 Simulator
13351335On Board ADS1299 Device ID: 0x12345
13361336LIS3DH Device ID: 0x38422$$$` ) ;
13371337
1338- expect ( openBCIUtilities . findV2Firmware ( buf ) ) . to . be . false ( ) ;
1338+ expect ( openBCIUtilities . getFirmware ( buf ) ) . to . equal ( null ) ;
13391339 } ) ;
13401340 it ( 'should find a v2' , function ( ) {
13411341 let buf = new Buffer ( `OpenBCI V3 Simulator
13421342On Board ADS1299 Device ID: 0x12345
13431343On Daisy ADS1299 Device ID: 0xFFFFF
13441344LIS3DH Device ID: 0x38422
1345- Firmware: v2
1345+ Firmware: v2.0.1
1346+ $$$` ) ;
1347+
1348+ expect ( openBCIUtilities . getFirmware ( buf ) ) . to . deep . equal ( {
1349+ major : 2 ,
1350+ minor : 0 ,
1351+ patch : 1
1352+ } ) ;
1353+ } ) ;
1354+ it ( 'should find a v3' , function ( ) {
1355+ let buf = new Buffer ( `OpenBCI V3 Simulator
1356+ On Board ADS1299 Device ID: 0x12345
1357+ On Daisy ADS1299 Device ID: 0xFFFFF
1358+ LIS3DH Device ID: 0x38422
1359+ Firmware: v3.0.1
13461360$$$` ) ;
13471361
1348- expect ( openBCIUtilities . findV2Firmware ( buf ) ) . to . equal ( true ) ;
1362+ expect ( openBCIUtilities . getFirmware ( buf ) ) . to . deep . equal ( {
1363+ major : 3 ,
1364+ minor : 0 ,
1365+ patch : 1
1366+ } ) ;
13491367 } ) ;
13501368 } ) ;
13511369 describe ( '#isFailureInBuffer' , function ( ) {
0 commit comments