@@ -16,6 +16,7 @@ import { ComponentSpecProvider } from "@/providers/ComponentSpecProvider";
1616import { ContextPanelProvider } from "@/providers/ContextPanelProvider" ;
1717import { ExecutionDataProvider } from "@/providers/ExecutionDataProvider" ;
1818import type { ComponentSpec } from "@/utils/componentSpec" ;
19+ import { BACKEND_QUERY_KEY } from "@/utils/constants" ;
1920
2021import { RunDetails } from "./RunDetails" ;
2122
@@ -62,6 +63,8 @@ describe("<RunDetails/>", () => {
6263 } ,
6364 } ) ;
6465
66+ const MOCK_BACKEND_URL = "http://localhost:8000" ;
67+
6568 const mockExecutionDetails : GetExecutionInfoResponse = {
6669 id : "test-execution-id" ,
6770 pipeline_run_id : "123" ,
@@ -133,13 +136,16 @@ describe("<RunDetails/>", () => {
133136 error : null ,
134137 } ) ;
135138
136- queryClient . setQueryData ( [ "pipeline-run-metadata" , "123" ] , mockPipelineRun ) ;
139+ queryClient . setQueryData (
140+ [ BACKEND_QUERY_KEY , "pipeline-run-metadata" , "123" ] ,
141+ mockPipelineRun ,
142+ ) ;
137143
138144 vi . mocked ( useBackend ) . mockReturnValue ( {
139145 configured : true ,
140146 available : true ,
141147 ready : true ,
142- backendUrl : "http://localhost:8000" ,
148+ backendUrl : MOCK_BACKEND_URL ,
143149 isConfiguredFromEnv : false ,
144150 isConfiguredFromRelativePath : false ,
145151 setEnvConfig : vi . fn ( ) ,
@@ -172,6 +178,50 @@ describe("<RunDetails/>", () => {
172178 } ) ;
173179 } ;
174180
181+ describe ( "Backend Configuration" , ( ) => {
182+ test ( "should render run details when backend is configured" , async ( ) => {
183+ // The default mock has configured: true and backendUrl: MOCK_BACKEND_URL
184+ // act
185+ renderWithProviders ( < RunDetails /> ) ;
186+
187+ // assert
188+ await waitFor ( ( ) => {
189+ expect ( screen . getByText ( "Test Pipeline" ) ) . toBeInTheDocument ( ) ;
190+ expect ( screen . getByText ( "Run Id:" ) ) . toBeInTheDocument ( ) ;
191+ expect ( screen . getByText ( "123" ) ) . toBeInTheDocument ( ) ;
192+ } ) ;
193+ } ) ;
194+
195+ test ( "should render run details when backendUrl is empty string" , async ( ) => {
196+ // arrange - simulate custom backend toggle disabled (empty backendUrl)
197+ vi . mocked ( useBackend ) . mockReturnValue ( {
198+ configured : true ,
199+ available : true ,
200+ ready : true ,
201+ backendUrl : "" ,
202+ isConfiguredFromEnv : false ,
203+ isConfiguredFromRelativePath : true ,
204+ setEnvConfig : vi . fn ( ) ,
205+ setRelativePathConfig : vi . fn ( ) ,
206+ setBackendUrl : vi . fn ( ) ,
207+ ping : vi . fn ( ) ,
208+ } ) ;
209+
210+ // Query key no longer includes backendUrl - cache is shared regardless of URL
211+ // and invalidated when backend URL changes
212+
213+ // act
214+ renderWithProviders ( < RunDetails /> ) ;
215+
216+ // assert
217+ await waitFor ( ( ) => {
218+ expect ( screen . getByText ( "Test Pipeline" ) ) . toBeInTheDocument ( ) ;
219+ expect ( screen . getByText ( "Run Id:" ) ) . toBeInTheDocument ( ) ;
220+ expect ( screen . getByText ( "123" ) ) . toBeInTheDocument ( ) ;
221+ } ) ;
222+ } ) ;
223+ } ) ;
224+
175225 describe ( "Inspect Pipeline Button" , ( ) => {
176226 test ( "should render inspect button when pipeline exists" , async ( ) => {
177227 // arrange
@@ -262,7 +312,7 @@ describe("<RunDetails/>", () => {
262312 } ;
263313
264314 queryClient . setQueryData (
265- [ "pipeline-run-metadata" , "123" ] ,
315+ [ BACKEND_QUERY_KEY , "pipeline-run-metadata" , "123" ] ,
266316 pipelineRunWithDifferentCreator ,
267317 ) ;
268318
0 commit comments