@@ -100,4 +100,55 @@ module.exports = () => {
100100 expect ( lhcFill . fillNumber ) . oneOf ( [ 6 , 3 ] )
101101 } ) ;
102102 } )
103+
104+ // Beam duration filter tests
105+
106+ it ( 'should only contain specified stable beam durations, < 12:00:00' , async ( ) => {
107+ getAllLhcFillsDto . query = { filter : { beamDuration : '43200' , beamDurationOperator : '<' , hasStableBeams : true } } ;
108+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto ) ;
109+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 3 )
110+ lhcFills . forEach ( ( lhcFill ) => {
111+ expect ( lhcFill . stableBeamsDuration ) . lessThan ( 43200 )
112+ } ) ;
113+ } ) ;
114+
115+ it ( 'should only contain specified stable beam durations, <= 12:00:00' , async ( ) => {
116+ getAllLhcFillsDto . query = { filter : { beamDuration : '43200' , beamDurationOperator : '<=' , hasStableBeams : true } } ;
117+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto )
118+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 4 )
119+ lhcFills . forEach ( ( lhcFill ) => {
120+ expect ( lhcFill . stableBeamsDuration ) . lessThanOrEqual ( 43200 )
121+ } ) ;
122+ } )
123+
124+ it ( 'should only contain specified stable beam durations, = 00:01:40' , async ( ) => {
125+ getAllLhcFillsDto . query = { filter : { beamDuration : '100' , beamDurationOperator : '=' , hasStableBeams : true } } ;
126+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto )
127+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 2 )
128+ lhcFills . forEach ( ( lhcFill ) => {
129+ expect ( lhcFill . stableBeamsDuration ) . equal ( 100 )
130+ } ) ;
131+ } ) ;
132+
133+ it ( 'should only contain specified stable beam durations, >= 00:01:40' , async ( ) => {
134+ getAllLhcFillsDto . query = { filter : { beamDuration : '100' , beamDurationOperator : '>=' , hasStableBeams : true } } ;
135+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto )
136+ console . log ( lhcFills ) ;
137+
138+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 4 )
139+ lhcFills . forEach ( ( lhcFill ) => {
140+ expect ( lhcFill . stableBeamsDuration ) . greaterThanOrEqual ( 100 )
141+ } ) ;
142+ } )
143+
144+ it ( 'should only contain specified stable beam durations, > 00:01:40' , async ( ) => {
145+ getAllLhcFillsDto . query = { filter : { beamDuration : '100' , beamDurationOperator : '>' , hasStableBeams : true } } ;
146+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto )
147+ console . log ( lhcFills ) ;
148+
149+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 2 )
150+ lhcFills . forEach ( ( lhcFill ) => {
151+ expect ( lhcFill . stableBeamsDuration ) . greaterThan ( 100 )
152+ } ) ;
153+ } )
103154} ;
0 commit comments