File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,33 @@ describe('Nexus', function () {
4242 } )
4343 expect ( version ) . to . equal ( '1.2.3' )
4444 } )
45+
46+ it ( 'filters versions and returns highest matching version' , function ( ) {
47+ const { version } = Nexus . prototype . transform ( {
48+ json : {
49+ items : [
50+ { version : '1.2.3' } ,
51+ { version : '1.2.10' } ,
52+ { version : '2.0.0' } ,
53+ ] ,
54+ } ,
55+ filter : '1.2.*' ,
56+ } )
57+ expect ( version ) . to . equal ( '1.2.10' )
58+ } )
59+
60+ it ( 'throws NotFound when filter matches no versions' , function ( ) {
61+ try {
62+ Nexus . prototype . transform ( {
63+ json : { items : [ { version : '1.2.3' } ] } ,
64+ filter : '9.*' ,
65+ } )
66+ expect . fail ( 'Expected to throw' )
67+ } catch ( e ) {
68+ expect ( e ) . to . be . an . instanceof ( NotFound )
69+ expect ( e . prettyMessage ) . to . equal ( 'no matching versions found' )
70+ }
71+ } )
4572 } )
4673
4774 describe ( 'auth' , function ( ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,15 @@ t.create('search release version valid artifact')
99 message : isVersion ,
1010 } )
1111
12+ t . create ( 'search release version with filter param' )
13+ . get (
14+ '/r/me.neznamy/tab-api.json?server=https://repo.tomkeuper.com&filter=4.*.*' ,
15+ )
16+ . expectBadge ( {
17+ label : 'nexus' ,
18+ message : isVersion ,
19+ } )
20+
1221t . create ( 'search release version of an nonexistent artifact' )
1322 . get (
1423 '/r/me.neznamy/nonexistent-artifact-id.json?server=https://repo.tomkeuper.com' ,
You can’t perform that action at this time.
0 commit comments