@@ -237,6 +237,24 @@ describe('Dispatcher', () => {
237237 const runnerLabels = [ [ 'self-hosted' , 'linux' , 'on-demand' ] ] ;
238238 expect ( canRunJob ( workflowLabels , runnerLabels , true ) ) . toBe ( true ) ;
239239 } ) ;
240+
241+ it ( 'should match with exactMatch=true when labels are in different order.' , ( ) => {
242+ const workflowLabels = [ 'linux' , 'self-hosted' , 'x64' ] ;
243+ const runnerLabels = [ [ 'self-hosted' , 'linux' , 'x64' ] ] ;
244+ expect ( canRunJob ( workflowLabels , runnerLabels , true ) ) . toBe ( true ) ;
245+ } ) ;
246+
247+ it ( 'should match with exactMatch=true when labels are completely shuffled.' , ( ) => {
248+ const workflowLabels = [ 'x64' , 'ubuntu-latest' , 'self-hosted' , 'linux' ] ;
249+ const runnerLabels = [ [ 'self-hosted' , 'linux' , 'x64' , 'ubuntu-latest' ] ] ;
250+ expect ( canRunJob ( workflowLabels , runnerLabels , true ) ) . toBe ( true ) ;
251+ } ) ;
252+
253+ it ( 'should match with exactMatch=false when labels are in different order.' , ( ) => {
254+ const workflowLabels = [ 'gpu' , 'self-hosted' ] ;
255+ const runnerLabels = [ [ 'self-hosted' , 'gpu' ] ] ;
256+ expect ( canRunJob ( workflowLabels , runnerLabels , false ) ) . toBe ( true ) ;
257+ } ) ;
240258 } ) ;
241259} ) ;
242260
0 commit comments