@@ -142,6 +142,37 @@ module.exports = () => {
142142 expect ( runs ) . to . lengthOf ( 20 ) ;
143143 } ) ;
144144
145+ it ( 'should successfully filter with single beamMode' , async ( ) => {
146+ const response = await request ( server ) . get ( '/api/runs?filter[beamModes]=STABLE BEAMS' ) ;
147+
148+ expect ( response . status ) . to . equal ( 200 ) ;
149+ const { data : runs } = response . body ;
150+
151+ expect ( runs ) . to . lengthOf ( 5 ) ;
152+ } ) ;
153+
154+ it ( 'should successfully filter with multiple beamModes' , async ( ) => {
155+ const response = await request ( server ) . get ( '/api/runs?filter[beamModes]=STABLE BEAMS,NO BEAM' ) ;
156+
157+ expect ( response . status ) . to . equal ( 200 ) ;
158+ const { data : runs } = response . body ;
159+
160+ expect ( runs ) . to . lengthOf ( 6 ) ;
161+ } ) ;
162+
163+ it ( 'should return 400 if beamModes filter has the incorrect format' , async ( ) => {
164+ const beamModeString = '*THERE\'S NON LETTERS IN HERE' ;
165+ const response = await request ( server ) . get ( `/api/runs?filter[beamModes]=${ beamModeString } ` ) ;
166+
167+
168+ expect ( response . status ) . to . equal ( 400 ) ;
169+
170+ const { errors : [ error ] } = response . body ;
171+
172+ expect ( error . title ) . to . equal ( 'Invalid Attribute' ) ;
173+ expect ( error . detail ) . to . equal ( `Beam modes "${ beamModeString } " must contain only uppercase letters and single spaces between words.` ) ;
174+ } ) ;
175+
145176 it ( 'should successfully filter on multiple specified run numbers' , async ( ) => {
146177 const response = await request ( server ) . get ( '/api/runs?filter[runNumbers]=17,18' ) ;
147178
0 commit comments