-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug: Execution Page's back button returns Workflows route from Launch…
… Plan route #patch (#760) * Bug: execution page back button from launch plan Signed-off-by: Frank Flitton <[email protected]> * change style of react import Signed-off-by: Frank Flitton <[email protected]> --------- Signed-off-by: Frank Flitton <[email protected]>
- Loading branch information
1 parent
3e8f517
commit e316bef
Showing
2 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
packages/console/src/components/Executions/Tables/test/WorkflowExecutionLink.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from 'react'; | ||
import { Router, Route } from 'react-router-dom'; | ||
import { history } from 'routes/history'; | ||
import { WorkflowExecutionIdentifier } from 'models'; | ||
import { fireEvent, render } from '@testing-library/react'; | ||
import { WorkflowExecutionLink } from '../WorkflowExecutionLink'; | ||
|
||
const testWorkflowId = { | ||
name: 'click-me', | ||
project: 'test-project', | ||
domain: 'test-domain', | ||
} as WorkflowExecutionIdentifier; | ||
|
||
const TestSubjectApp = () => ( | ||
<div> | ||
<Route | ||
exact | ||
path="/console/projects/flytesnacks/domains/development/executions/:executionId" | ||
render={() => ( | ||
<div> | ||
<h1>Welcome</h1> | ||
</div> | ||
)} | ||
/> | ||
<Route | ||
path="/console/projects/flytesnacks/domains/development/launchPlans/:launchPlanName" | ||
render={() => ( | ||
<div> | ||
<h1>Dashboard</h1> | ||
<WorkflowExecutionLink | ||
id={testWorkflowId} | ||
className="test-click-me" | ||
/> | ||
</div> | ||
)} | ||
/> | ||
</div> | ||
); | ||
|
||
it('should format a backlink on navigation', () => { | ||
const initialPathname = | ||
'/console/projects/flytesnacks/domains/development/launchPlans/testId'; | ||
const initialUrl = `${initialPathname}?foo=bar#hash`; | ||
|
||
history.push(initialUrl); | ||
|
||
const testRender = render( | ||
<Router history={history}> | ||
Foo | ||
<TestSubjectApp /> | ||
</Router>, | ||
); | ||
|
||
expect(history.location.pathname).toBe(initialPathname); | ||
|
||
fireEvent.click(testRender.getByText(testWorkflowId.name)); | ||
|
||
// Navigated | ||
expect(history.location.state?.backLink).toBe(initialUrl); | ||
}); |