make sure to pass the correct form of process group id when creating a process model w/ burnettk cullerton

This commit is contained in:
jasquat 2022-11-21 15:39:33 -05:00
parent ee39177b20
commit 53d8b3f140
4 changed files with 11 additions and 4 deletions

View File

@ -42,7 +42,7 @@ describe('process-models', () => {
it.only('can create new bpmn, dmn, and json files', () => { it.only('can create new bpmn, dmn, and json files', () => {
const uuid = () => Cypress._.random(0, 1e6); const uuid = () => Cypress._.random(0, 1e6);
const id = uuid(); const id = uuid();
const groupId = 'acceptance-tests-group-one'; const groupId = 'misc/acceptance-tests-group-one';
const groupDisplayName = 'Acceptance Tests Group One'; const groupDisplayName = 'Acceptance Tests Group One';
const modelDisplayName = `Test Model 2 ${id}`; const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`; const modelId = `test-model-2-${id}`;
@ -51,6 +51,7 @@ describe('process-models', () => {
const dmnFileName = `dmn_test_file_${id}`; const dmnFileName = `dmn_test_file_${id}`;
const jsonFileName = `json_test_file_${id}`; const jsonFileName = `json_test_file_${id}`;
cy.contains('Misc').click();
cy.contains(groupDisplayName).click(); cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName); cy.createModel(groupId, modelId, modelDisplayName);
cy.contains(groupId).click(); cy.contains(groupId).click();

View File

@ -76,7 +76,10 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => {
cy.get('input[name=id]').should('have.value', modelId); cy.get('input[name=id]').should('have.value', modelId);
cy.contains('Submit').click(); cy.contains('Submit').click();
cy.url().should('include', `process-models/${groupId}:${modelId}`); cy.url().should(
'include',
`process-models/${cy.modifyProcessModelPath(groupId)}:${modelId}`
);
cy.contains(`Process Model: ${modelDisplayName}`); cy.contains(`Process Model: ${modelDisplayName}`);
}); });

View File

@ -52,7 +52,9 @@ export default function ProcessModelForm({
if (hasErrors) { if (hasErrors) {
return; return;
} }
const path = `/process-models/${processGroupId}`; const path = `/process-models/${modifyProcessModelPath(
processGroupId || ''
)}`;
let httpMethod = 'POST'; let httpMethod = 'POST';
if (mode === 'edit') { if (mode === 'edit') {
httpMethod = 'PUT'; httpMethod = 'PUT';

View File

@ -3,6 +3,7 @@ import { useParams } from 'react-router-dom';
import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
import { ProcessModel } from '../interfaces'; import { ProcessModel } from '../interfaces';
import ProcessModelForm from '../components/ProcessModelForm'; import ProcessModelForm from '../components/ProcessModelForm';
import { unModifyProcessModelPath } from '../helpers';
export default function ProcessModelNew() { export default function ProcessModelNew() {
const params = useParams(); const params = useParams();
@ -28,7 +29,7 @@ export default function ProcessModelNew() {
<h1>Add Process Model</h1> <h1>Add Process Model</h1>
<ProcessModelForm <ProcessModelForm
mode="new" mode="new"
processGroupId={params.process_group_id} processGroupId={unModifyProcessModelPath(params.process_group_id || '')}
processModel={processModel} processModel={processModel}
setProcessModel={setProcessModel} setProcessModel={setProcessModel}
/> />