11import test from 'ava' ;
2- import m from '.' ;
2+ import semverRegex from '.' ;
33
4- const fixture = [
4+ const fixtures = [
55 '0.0.0' ,
66 '0.10.0' ,
77 'v1.0.0' ,
@@ -16,26 +16,26 @@ const fixture = [
1616] ;
1717
1818test ( 'matches semver versions on test' , t => {
19- for ( const el of fixture ) {
20- t . regex ( el , m ( ) ) ;
19+ for ( const fixture of fixtures ) {
20+ t . regex ( fixture , semverRegex ( ) ) ;
2121 }
2222
23- t . notRegex ( '0.88' , m ( ) ) ;
24- t . notRegex ( '1.0.08' , m ( ) ) ;
25- t . notRegex ( '1.08.0' , m ( ) ) ;
26- t . notRegex ( '01.8.0' , m ( ) ) ;
23+ t . notRegex ( '0.88' , semverRegex ( ) ) ;
24+ t . notRegex ( '1.0.08' , semverRegex ( ) ) ;
25+ t . notRegex ( '1.08.0' , semverRegex ( ) ) ;
26+ t . notRegex ( '01.8.0' , semverRegex ( ) ) ;
2727} ) ;
2828
2929test ( 'returns semver on match' , t => {
30- t . deepEqual ( '0.0.0' . match ( m ( ) ) , [ '0.0.0' ] ) ;
31- t . deepEqual ( 'foo 0.0.0 bar 0.1.1' . match ( m ( ) ) , [ '0.0.0' , '0.1.1' ] ) ;
30+ t . deepEqual ( '0.0.0' . match ( semverRegex ( ) ) , [ '0.0.0' ] ) ;
31+ t . deepEqual ( 'foo 0.0.0 bar 0.1.1' . match ( semverRegex ( ) ) , [ '0.0.0' , '0.1.1' ] ) ;
3232} ) ;
3333
3434test ( '#7, does not return tag prefix' , t => {
35- t . deepEqual ( 'v0.0.0' . match ( m ( ) ) , [ '0.0.0' ] ) ;
35+ t . deepEqual ( 'v0.0.0' . match ( semverRegex ( ) ) , [ '0.0.0' ] ) ;
3636} ) ;
3737
38- test ( '#14, does not match substrings of longer semver-similar strings, respect semver2 .0.0 clause 9' , t => {
38+ test ( '#14, does not match sub-strings of longer semver-similar strings, respect semver@2 .0.0 clause 9' , t => {
3939 const invalidStrings = [
4040 '1' ,
4141 '1.2' ,
@@ -80,6 +80,6 @@ test('#14, does not match substrings of longer semver-similar strings, respect s
8080 ] ;
8181
8282 for ( const string of invalidStrings ) {
83- t . notRegex ( string , m ( ) ) ;
83+ t . notRegex ( string , semverRegex ( ) ) ;
8484 }
8585} ) ;
0 commit comments