@@ -198,6 +198,49 @@ async fn stop_number_returns_single_route_stop_schedule_to_approved_number(db: P
198198 ) ;
199199}
200200
201+ #[ sqlx:: test( fixtures( "numbers-approved" ) ) ]
202+ async fn stop_number_returns_single_route_ignoring_case ( db : PgPool ) {
203+ let mock_winnipeg_transit_api = MockServer :: start ( ) . await ;
204+ let mock_stop_schedule_response = fs:: read_to_string ( "tests/fixtures/times/stop_schedule.json" )
205+ . expect ( "Failed to read stop schedule fixture" ) ;
206+
207+ Mock :: given ( method ( "GET" ) )
208+ . and ( path_regex ( r"^/v4/stops/.*/schedule.json$" ) )
209+ . respond_with (
210+ ResponseTemplate :: new ( 200 ) . set_body_string ( mock_stop_schedule_response. clone ( ) ) ,
211+ )
212+ . expect ( 1 )
213+ . mount ( & mock_winnipeg_transit_api)
214+ . await ;
215+
216+ let response = get (
217+ "/twilio?Body=10619 blue&From=approved&To=textabus&MessageSid=SM1849" ,
218+ InjectableServices {
219+ db : db. clone ( ) ,
220+ twilio_address : None ,
221+ winnipeg_transit_api_address : Some ( mock_winnipeg_transit_api. uri ( ) ) ,
222+ } ,
223+ )
224+ . await
225+ . expect ( "Failed to execute request" ) ;
226+
227+ assert ! ( response. status( ) . is_success( ) ) ;
228+ assert_eq ! ( response. headers( ) [ "content-type" ] , "text/xml" ) ;
229+
230+ let document = Document :: from ( response. text ( ) . await . unwrap ( ) . as_str ( ) ) ;
231+ let body = & document. find ( Name ( "body" ) ) . next ( ) . unwrap ( ) . text ( ) ;
232+
233+ let expected_body = indoc ! { "
234+ 10619 WB Graham@Vaughan (The Bay)
235+ 12:19p BLUE Downtown (8min late)
236+ 12:22p BLUE Downtown
237+ 12:33p BLUE Downtown
238+ 12:45p BLUE Downtown
239+ " } ;
240+
241+ assert_that ( body) . contains ( expected_body) ;
242+ }
243+
201244#[ sqlx:: test( fixtures( "numbers-approved" ) ) ]
202245async fn incorrect_stop_number_returns_error ( db : PgPool ) {
203246 let mock_winnipeg_transit_api = MockServer :: start ( ) . await ;
0 commit comments