forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): refactor code. Fixes argoproj#1214
Signed-off-by: Sairam Arunachalam <sair.aruna@gmail.com>
- Loading branch information
Showing
4 changed files
with
39 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {createBrowserHistory, createPath} from 'history'; | ||
import {getWorkflowParametersFromQuery} from './get_workflow_params'; | ||
|
||
describe('get_workflow_params', () => { | ||
it('should return an empty object when there are no query parameters', () => { | ||
const history = createBrowserHistory(); | ||
const result = getWorkflowParametersFromQuery(history); | ||
expect(result).toEqual({}); | ||
}); | ||
|
||
it('should return the parameters provided in the URL', () => { | ||
const history = createBrowserHistory(); | ||
const path = createPath({pathname: '/workflows', search: '?parameters[key1]=value1¶meters[key2]=value2'}); | ||
history.location.search = path; | ||
const result = getWorkflowParametersFromQuery(history); | ||
expect(result).toEqual({ | ||
key1: 'value1', | ||
key2: 'value2' | ||
}); | ||
}); | ||
|
||
it('should only return the parameters provided in the URL', () => { | ||
const history = createBrowserHistory(); | ||
const path = createPath({pathname: '/workflows', search: '?parameters[key1]=value1¶meters[key2]=value2&test=123'}); | ||
history.location.search = path; | ||
const result = getWorkflowParametersFromQuery(history); | ||
expect(result).toEqual({ | ||
key1: 'value1', | ||
key2: 'value2' | ||
}); | ||
}); | ||
}); |
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
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
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