@@ -74,6 +74,52 @@ describe("Routes", () => {
7474 ) . not . toBeNull ( ) ;
7575 } ) ;
7676
77+ it ( "renders matched/threshold/degraded stat with dash separator" , async ( ) => {
78+ const data = {
79+ items : [
80+ {
81+ ...ROUTES . items [ 0 ] ,
82+ route_result : {
83+ quality : "clear" ,
84+ state : "healthy" ,
85+ matched_count : 3 ,
86+ threshold : 5 ,
87+ effective_clear : 2 ,
88+ } ,
89+ } ,
90+ ] ,
91+ } ;
92+ vi . spyOn ( api , "apiGet" ) . mockImplementation ( async ( path ) => {
93+ if ( path === "/api/v1/routes" ) return data ;
94+ if ( path . match ( / \/ a p i \/ v 1 \/ r o u t e s \/ [ ^ / ] + $ / ) ) return ROUTE_DETAIL ;
95+ if ( path . includes ( "/history" ) ) return ROUTE_HISTORY ;
96+ throw new Error ( `Unexpected: ${ path } ` ) ;
97+ } ) ;
98+ renderWithProviders ( < Routes /> ) ;
99+ await waitFor ( ( ) => {
100+ expect ( screen . getByText ( "3/5-2" ) ) . toBeInTheDocument ( ) ;
101+ } ) ;
102+ } ) ;
103+
104+ it ( "shows Now label for the last history chart entry" , async ( ) => {
105+ const historyWithData = {
106+ data : [
107+ { date : "2026-07-20" , matched : 0 , total : 0 } ,
108+ { date : "2026-07-21" , matched : 1 , total : 1 } ,
109+ ] ,
110+ } ;
111+ vi . spyOn ( api , "apiGet" ) . mockImplementation ( async ( path ) => {
112+ if ( path === "/api/v1/routes" ) return ROUTES ;
113+ if ( path . match ( / \/ a p i \/ v 1 \/ r o u t e s \/ [ ^ / ] + $ / ) ) return ROUTE_DETAIL ;
114+ if ( path . includes ( "/history" ) ) return historyWithData ;
115+ throw new Error ( `Unexpected: ${ path } ` ) ;
116+ } ) ;
117+ renderWithProviders ( < Routes /> ) ;
118+ await waitFor ( ( ) => {
119+ expect ( screen . getByText ( "common.now" ) ) . toBeInTheDocument ( ) ;
120+ } ) ;
121+ } ) ;
122+
77123 it ( "shows an error on fetch failure" , async ( ) => {
78124 vi . spyOn ( api , "apiGet" ) . mockRejectedValue ( new Error ( "routes error" ) ) ;
79125 renderWithProviders ( < Routes /> ) ;
0 commit comments