Skip to content

Commit

Permalink
fixed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Aug 30, 2024
1 parent 94a2989 commit d8db107
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
26 changes: 24 additions & 2 deletions src/containers/Flow/Flow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,35 @@ const mocks = [
getFilterTagQuery,
getRoleNameQuery,
getOrganizationLanguagesQuery,
copyFlowQuery(),
copyFlowQuery(true),
copyFlowQuery({
isActive: true,
isPinned: false,
isBackground: false,
name: 'Copy of Help',
keywords: [],
description: '',
ignoreKeywords: false,
addRoleIds: [],
deleteRoleIds: [],
}),
copyFlowQuery({
isActive: true,
isPinned: false,
isBackground: false,
name: 'Copy of Help',
keywords: ['help', 'activity'],
description: 'Help flow',
ignoreKeywords: false,
addRoleIds: [],
deleteRoleIds: [],
tag_id: '1',
}),
createFlowQuery,
createTagQuery,
getFlowCountQuery({ isActive: true, isTemplate: false }),
releaseFlow,
getFilterTagQuery,
updateFlowQuery,
];

const mockUseLocationValue: any = {
Expand Down
16 changes: 14 additions & 2 deletions src/containers/Flow/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,23 @@ export const Flow = () => {
cancelLink = 'flow?isTemplate=true';
}

const additionalAction = {
label: isTemplate ? t('View') : t('Configure'),
const configureAction = {
label: t('Configure'),
link: '/flow/configure',
};

const viewAction = {
label: t('View'),
link: '/flow/configure',
action: (link: any) => {
navigate(link, {
state: 'template',
});
},
};

const additionalAction = isTemplate ? viewAction : configureAction;

const formFields = [
{
component: Input,
Expand Down
18 changes: 1 addition & 17 deletions src/mocks/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -663,23 +663,7 @@ export const exportFlowTranslationsWithErrors = {
},
};

export const copyFlowQuery = (template: boolean = false) => {
let input = {
isActive: true,
isPinned: false,
isBackground: false,
name: 'Copy of Help',
keywords: template ? [] : ['help', 'activity'],
description: template ? '' : 'Help flow',
ignoreKeywords: false,
addRoleIds: [],
deleteRoleIds: [],
};

if (!template) {
Object.assign(input, { tag_id: '1' });
}

export const copyFlowQuery = (input: any) => {
return {
request: {
query: CREATE_FLOW_COPY,
Expand Down

0 comments on commit d8db107

Please sign in to comment.