@@ -17,6 +17,7 @@ import { ContextPanelProvider } from "@/providers/ContextPanelProvider";
1717import { ExecutionDataProvider } from "@/providers/ExecutionDataProvider" ;
1818import * as executionService from "@/services/executionService" ;
1919import type { ComponentSpec } from "@/utils/componentSpec" ;
20+ import { BACKEND_QUERY_KEY } from "@/utils/constants" ;
2021
2122import { RunDetails } from "./RunDetails" ;
2223
@@ -67,6 +68,8 @@ describe("<RunDetails/>", () => {
6768 } ,
6869 } ) ;
6970
71+ const MOCK_BACKEND_URL = "http://localhost:8000" ;
72+
7073 const mockExecutionDetails : GetExecutionInfoResponse = {
7174 id : "test-execution-id" ,
7275 pipeline_run_id : "123" ,
@@ -138,7 +141,10 @@ describe("<RunDetails/>", () => {
138141 error : null ,
139142 } ) ;
140143
141- queryClient . setQueryData ( [ "pipeline-run-metadata" , "123" ] , mockPipelineRun ) ;
144+ queryClient . setQueryData (
145+ [ BACKEND_QUERY_KEY , "pipeline-run-metadata" , "123" ] ,
146+ mockPipelineRun ,
147+ ) ;
142148
143149 vi . mocked ( executionService . countTaskStatuses ) . mockReturnValue ( {
144150 total : 2 ,
@@ -160,7 +166,7 @@ describe("<RunDetails/>", () => {
160166 configured : true ,
161167 available : true ,
162168 ready : true ,
163- backendUrl : "http://localhost:8000" ,
169+ backendUrl : MOCK_BACKEND_URL ,
164170 isConfiguredFromEnv : false ,
165171 isConfiguredFromRelativePath : false ,
166172 setEnvConfig : vi . fn ( ) ,
@@ -193,6 +199,50 @@ describe("<RunDetails/>", () => {
193199 } ) ;
194200 } ;
195201
202+ describe ( "Backend Configuration" , ( ) => {
203+ test ( "should render run details when backend is configured" , async ( ) => {
204+ // The default mock has configured: true and backendUrl: MOCK_BACKEND_URL
205+ // act
206+ renderWithProviders ( < RunDetails /> ) ;
207+
208+ // assert
209+ await waitFor ( ( ) => {
210+ expect ( screen . getByText ( "Test Pipeline" ) ) . toBeInTheDocument ( ) ;
211+ expect ( screen . getByText ( "Run Id:" ) ) . toBeInTheDocument ( ) ;
212+ expect ( screen . getByText ( "123" ) ) . toBeInTheDocument ( ) ;
213+ } ) ;
214+ } ) ;
215+
216+ test ( "should render run details when backendUrl is empty string" , async ( ) => {
217+ // arrange - simulate custom backend toggle disabled (empty backendUrl)
218+ vi . mocked ( useBackend ) . mockReturnValue ( {
219+ configured : true ,
220+ available : true ,
221+ ready : true ,
222+ backendUrl : "" ,
223+ isConfiguredFromEnv : false ,
224+ isConfiguredFromRelativePath : true ,
225+ setEnvConfig : vi . fn ( ) ,
226+ setRelativePathConfig : vi . fn ( ) ,
227+ setBackendUrl : vi . fn ( ) ,
228+ ping : vi . fn ( ) ,
229+ } ) ;
230+
231+ // Query key no longer includes backendUrl - cache is shared regardless of URL
232+ // and invalidated when backend URL changes
233+
234+ // act
235+ renderWithProviders ( < RunDetails /> ) ;
236+
237+ // assert
238+ await waitFor ( ( ) => {
239+ expect ( screen . getByText ( "Test Pipeline" ) ) . toBeInTheDocument ( ) ;
240+ expect ( screen . getByText ( "Run Id:" ) ) . toBeInTheDocument ( ) ;
241+ expect ( screen . getByText ( "123" ) ) . toBeInTheDocument ( ) ;
242+ } ) ;
243+ } ) ;
244+ } ) ;
245+
196246 describe ( "Inspect Pipeline Button" , ( ) => {
197247 test ( "should render inspect button when pipeline exists" , async ( ) => {
198248 // arrange
@@ -282,7 +332,7 @@ describe("<RunDetails/>", () => {
282332 } ;
283333
284334 queryClient . setQueryData (
285- [ "pipeline-run-metadata" , "123" ] ,
335+ [ BACKEND_QUERY_KEY , "pipeline-run-metadata" , "123" ] ,
286336 pipelineRunWithDifferentCreator ,
287337 ) ;
288338
0 commit comments