@@ -40,4 +40,52 @@ module.exports = () => {
4040 expect ( lhcFill . stableBeamsStart ) . to . not . be . null ;
4141 } ) ;
4242 } ) ;
43+
44+ // Fill number filter tests
45+
46+ it ( 'should only contain specified fill number' , async ( ) => {
47+ getAllLhcFillsDto . query = { filter : { hasStableBeams : true , fillNumbers : '6' } } ;
48+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto ) ;
49+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 1 )
50+
51+ lhcFills . forEach ( ( lhcFill ) => {
52+ expect ( lhcFill . fillNumber ) . to . equal ( 6 )
53+ } ) ;
54+ } )
55+
56+ it ( 'should only contain specified fill numbers' , async ( ) => {
57+ getAllLhcFillsDto . query = { filter : { hasStableBeams : true , fillNumbers : '6,3' } } ;
58+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto ) ;
59+
60+
61+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 2 )
62+
63+ lhcFills . forEach ( ( lhcFill ) => {
64+ expect ( lhcFill . fillNumber ) . oneOf ( [ 6 , 3 ] )
65+ } ) ;
66+ } )
67+
68+ it ( 'should only contain specified fill numbers, whitespace' , async ( ) => {
69+ getAllLhcFillsDto . query = { filter : { hasStableBeams : true , fillNumbers : ' 6 , 3 ' } } ;
70+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto ) ;
71+
72+
73+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 2 )
74+
75+ lhcFills . forEach ( ( lhcFill ) => {
76+ expect ( lhcFill . fillNumber ) . oneOf ( [ 6 , 3 ] )
77+ } ) ;
78+ } )
79+
80+ it ( 'should only contain specified fill numbers, comma misplacement' , async ( ) => {
81+ getAllLhcFillsDto . query = { filter : { hasStableBeams : true , fillNumbers : ',6,3,' } } ;
82+ const { lhcFills } = await new GetAllLhcFillsUseCase ( ) . execute ( getAllLhcFillsDto ) ;
83+
84+
85+ expect ( lhcFills ) . to . be . an ( 'array' ) . and . lengthOf ( 2 )
86+
87+ lhcFills . forEach ( ( lhcFill ) => {
88+ expect ( lhcFill . fillNumber ) . oneOf ( [ 6 , 3 ] )
89+ } ) ;
90+ } )
4391} ;
0 commit comments