@@ -343,27 +343,51 @@ describe('Plugin tests', () => {
343343 type : 'testResource' ,
344344 } )
345345
346- expect ( resourceInfo . allowMultiple ?. requiredParameters ) . toMatchObject ( [
347- 'path' , 'paths'
348- ] )
346+ expect ( resourceInfo . allowMultiple ) . to . be . true ;
349347 } )
350348
351- it ( 'Returns an empty array by default for allowMultiple for getResourceInfo ' , async ( ) => {
349+ it ( 'Can match resources together ' , async ( ) => {
352350 const resource = spy ( new class extends TestResource {
353351 getSettings ( ) : ResourceSettings < TestConfig > {
354352 return {
355353 ...super . getSettings ( ) ,
356- allowMultiple : true
354+ parameterSettings : {
355+ path : { type : 'directory' } ,
356+ paths : { type : 'array' , itemType : 'directory' }
357+ } ,
358+ allowMultiple : {
359+ identifyingParameters : [ 'path' , 'paths' ]
360+ }
357361 }
358362 }
359363 } )
360364
361365 const testPlugin = Plugin . create ( 'testPlugin' , [ resource as any ] ) ;
362366
363- const resourceInfo = await testPlugin . getResourceInfo ( {
364- type : 'testResource' ,
367+ const { match } = await testPlugin . match ( {
368+ resource : {
369+ core : { type : 'testResource' } ,
370+ parameters : { path : '/my/path' , propA : 'abc' } ,
371+ } ,
372+ array : [
373+ {
374+ core : { type : 'testResource' } ,
375+ parameters : { path : '/my/other/path' , propA : 'abc' } ,
376+ } ,
377+ {
378+ core : { type : 'testResource' } ,
379+ parameters : { paths : [ '/my/path' ] , propA : 'def' } ,
380+ } ,
381+ {
382+ core : { type : 'testResource' } ,
383+ parameters : { path : '/my/path' , propA : 'hig' } ,
384+ } ,
385+ ]
386+ } )
387+ expect ( match ) . toMatchObject ( {
388+ core : { type : 'testResource' } ,
389+ parameters : { path : '/my/path' , propA : 'hig' } ,
365390 } )
366391
367- expect ( resourceInfo . allowMultiple ?. requiredParameters ) . toMatchObject ( [ ] )
368392 } )
369393} ) ;
0 commit comments