File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
var match = process . version . match ( / v ( \d + ) \. ( \d + ) \. ( \d + ) / ) ;
4
4
var nodeVersion = {
5
- major : match [ 1 ] ,
6
- minor : match [ 2 ] ,
7
- patch : match [ 3 ] ,
5
+ major : parseInt ( match [ 1 ] , 10 ) ,
6
+ minor : parseInt ( match [ 2 ] , 10 ) ,
7
+ patch : parseInt ( match [ 3 ] , 10 ) ,
8
8
} ;
9
9
10
10
module . exports = nodeVersion ;
Original file line number Diff line number Diff line change @@ -6,6 +6,16 @@ var code = require('code');
6
6
var defaultResolution = require ( '../' ) ;
7
7
var nodeVersion = require ( '../node-version' ) ;
8
8
9
+ lab . describe ( 'nodeVersion' , function ( ) {
10
+
11
+ lab . it ( 'has all integers and not strings' , function ( done ) {
12
+ code . expect ( nodeVersion . major ) . to . be . a . number ( ) ;
13
+ code . expect ( nodeVersion . minor ) . to . be . a . number ( ) ;
14
+ code . expect ( nodeVersion . patch ) . to . be . a . number ( ) ;
15
+ done ( ) ;
16
+ } ) ;
17
+ } ) ;
18
+
9
19
lab . describe ( 'defaultResolution' , function ( ) {
10
20
// Typically I don't unit test helpers, but this reduces the last run tests
11
21
var major = nodeVersion . major ;
You can’t perform that action at this time.
0 commit comments