Skip to content

Commit

Permalink
feat(ui): fix tests. Fixes argoproj#1214
Browse files Browse the repository at this point in the history
Signed-off-by: Sairam Arunachalam <sair.aruna@gmail.com>
  • Loading branch information
sairam91 committed Oct 17, 2024
1 parent 2340b21 commit d34ee68
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ui/src/app/shared/get_workflow_params.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createBrowserHistory, createPath} from 'history';
import {createBrowserHistory} from 'history';
import {getWorkflowParametersFromQuery} from './get_workflow_params';

describe('get_workflow_params', () => {
Expand All @@ -10,19 +10,24 @@ describe('get_workflow_params', () => {

it('should return the parameters provided in the URL', () => {
const history = createBrowserHistory();
const path = createPath({pathname: '/workflows', search: '?parameters[key1]=value1&parameters[key2]=value2'});
history.location.search = path;
history.location.search = '?parameters[key1]=value1&parameters[key2]=value2';
const result = getWorkflowParametersFromQuery(history);
expect(result).toEqual({
key1: 'value1',
key2: 'value2'
});
});

it('should not return any key value pairs which are not in parameters query ', () => {
const history = createBrowserHistory();
history.location.search = '?retryparameters[key1]=value1&retryparameters[key2]=value2';
const result = getWorkflowParametersFromQuery(history);
expect(result).toEqual({});
});

it('should only return the parameters provided in the URL', () => {
const history = createBrowserHistory();
const path = createPath({pathname: '/workflows', search: '?parameters[key1]=value1&parameters[key2]=value2&test=123'});
history.location.search = path;
history.location.search = '?parameters[key1]=value1&parameters[key2]=value2&test=123';
const result = getWorkflowParametersFromQuery(history);
expect(result).toEqual({
key1: 'value1',
Expand Down

0 comments on commit d34ee68

Please sign in to comment.