File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,6 +183,32 @@ module.exports = () => {
183183 }
184184 } ) ;
185185
186+ it ( 'should successfully filter on beamModes' , async ( ) => {
187+ const singleBeamMode = [ 'STABLE BEAMS' ] ;
188+ const multipleBeamMode = [ 'STABLE BEAMS' , 'NO BEAM' ] ;
189+ const nonExistentBeamMode = [ 'DOES NOT EXIST' ] ;
190+
191+ getAllRunsDto . query = { filter : { beamModes : singleBeamMode } } ;
192+ {
193+ const { runs } = await new GetAllRunsUseCase ( ) . execute ( getAllRunsDto ) ;
194+ expect ( runs ) . to . have . lengthOf ( 5 ) ;
195+ expect ( runs . every ( ( { lhcBeamMode } ) => singleBeamMode . includes ( lhcBeamMode ) ) ) . to . be . true ;
196+ }
197+
198+ getAllRunsDto . query = { filter : { beamModes : multipleBeamMode } } ;
199+ {
200+ const { runs } = await new GetAllRunsUseCase ( ) . execute ( getAllRunsDto ) ;
201+ expect ( runs ) . to . have . lengthOf ( 6 ) ;
202+ expect ( runs . every ( ( { lhcBeamMode } ) => multipleBeamMode . includes ( lhcBeamMode ) ) ) . to . be . true ;
203+ }
204+
205+ getAllRunsDto . query = { filter : { beamModes : nonExistentBeamMode } } ;
206+ {
207+ const { runs } = await new GetAllRunsUseCase ( ) . execute ( getAllRunsDto ) ;
208+ expect ( runs ) . to . have . lengthOf ( 0 ) ;
209+ }
210+ } ) ;
211+
186212 it ( 'should successfully filter on run definition' , async ( ) => {
187213 const PHYSICS_COUNT = 7 ;
188214 const COSMICS_COUNT = 2 ;
You can’t perform that action at this time.
0 commit comments