From b3fdbdf570c104bc3b01e9920f2b197cb98619ce Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Wed, 29 May 2024 00:24:18 +0200 Subject: [PATCH] test(drilldown): re-structure specs + verify additional cases --- test/spec/features/drilldown/DrilldownSpec.js | 95 +++++++++++++++---- .../drilldown/diagram-missing-plane.bpmn | 10 ++ .../drilldown/plane-missing-bpmnelement.bpmn | 11 +++ ...mn => subprocess-missing-bpmndiagram.bpmn} | 12 +-- .../drilldown/subprocess-missing-di.bpmn | 15 +++ 5 files changed, 118 insertions(+), 25 deletions(-) create mode 100644 test/spec/features/drilldown/diagram-missing-plane.bpmn create mode 100644 test/spec/features/drilldown/plane-missing-bpmnelement.bpmn rename test/spec/features/drilldown/{missing-di-bpmndiagram-plane.bpmn => subprocess-missing-bpmndiagram.bpmn} (64%) create mode 100644 test/spec/features/drilldown/subprocess-missing-di.bpmn diff --git a/test/spec/features/drilldown/DrilldownSpec.js b/test/spec/features/drilldown/DrilldownSpec.js index 933443d02..d17620e1f 100644 --- a/test/spec/features/drilldown/DrilldownSpec.js +++ b/test/spec/features/drilldown/DrilldownSpec.js @@ -3,7 +3,7 @@ import { } from 'test/TestHelper'; import coreModule from 'lib/core'; -import DrilldownModule from 'lib/features/drilldown'; +import drilldownModule from 'lib/features/drilldown'; import modelingModule from 'lib/features/modeling'; import { bootstrapModeler, getBpmnJS } from '../../../helper'; import { classes } from 'min-dom'; @@ -14,7 +14,7 @@ describe('features - drilldown', function() { var testModules = [ coreModule, modelingModule, - DrilldownModule + drilldownModule ]; var collaborationXML = require('./collaboration-subprocesses.bpmn'); @@ -537,32 +537,93 @@ describe('features/drilldown - integration', function() { var testModules = [ coreModule, - DrilldownModule + modelingModule, + drilldownModule ]; - var missingDiXML = require('./missing-di-bpmndiagram-plane.bpmn'); + var workingXML = require('./nested-subprocesses.bpmn'); - var multiLayerXML = require('./nested-subprocesses.bpmn'); + beforeEach(bootstrapModeler(workingXML, { modules: testModules })); - beforeEach(bootstrapModeler(multiLayerXML, { modules: testModules })); + describe('error handling - should handle broken DI', function() { + + const subprocessMissingDi_XML = require('./subprocess-missing-di.bpmn'); + const subprocessMissingBpmnDiagram_XML = require('./subprocess-missing-bpmndiagram.bpmn'); + const processMissingBpmnDiagram_XML = require('./process-missing-bpmndiagram.bpmn'); - describe('error handling', function() { + const planeMissingBpmnElement_XML = require('./plane-missing-bpmnelement.bpmn'); + const diagramMissingPlane_XML = require('./diagram-missing-plane.bpmn'); - it('should import diagram with missing BPMNDiagram#plane', inject( - async function(bpmnjs) { - let error; + async function importXML(xml) { + const bpmnJS = getBpmnJS(); - try { - await bpmnjs.importXML(missingDiXML); - } catch (_error) { - error = _error; - } + let result; - expect(error).not.to.exist; + try { + result = await bpmnJS.importXML(xml); + } catch (error) { + result = { + error, + warnings: error.warnings + }; } - )); + + return result; + } + + + it('no ', async function() { + + const { + error, + warnings + } = await importXML(diagramMissingPlane_XML); + + // then + expect(error).not.to.exist; + expect(warnings).to.be.empty; + }); + + + it('no ', async function() { + + const { + error, + warnings + } = await importXML(planeMissingBpmnElement_XML); + + // then + expect(error).not.to.exist; + expect(warnings).to.be.empty; + }); + + + it('no for sub process', async function() { + + const { + error, + warnings + } = await importXML(subprocessMissingDi_XML); + + // then + expect(error).not.to.exist; + expect(warnings).to.be.empty; + }); + + + it('no for sub process', async function() { + + const { + error, + warnings + } = await importXML(subprocessMissingBpmnDiagram_XML); + + // then + expect(error).not.to.exist; + expect(warnings).to.be.empty; + }); }); diff --git a/test/spec/features/drilldown/diagram-missing-plane.bpmn b/test/spec/features/drilldown/diagram-missing-plane.bpmn new file mode 100644 index 000000000..d039643df --- /dev/null +++ b/test/spec/features/drilldown/diagram-missing-plane.bpmn @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/test/spec/features/drilldown/plane-missing-bpmnelement.bpmn b/test/spec/features/drilldown/plane-missing-bpmnelement.bpmn new file mode 100644 index 000000000..369f592f8 --- /dev/null +++ b/test/spec/features/drilldown/plane-missing-bpmnelement.bpmn @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/spec/features/drilldown/missing-di-bpmndiagram-plane.bpmn b/test/spec/features/drilldown/subprocess-missing-bpmndiagram.bpmn similarity index 64% rename from test/spec/features/drilldown/missing-di-bpmndiagram-plane.bpmn rename to test/spec/features/drilldown/subprocess-missing-bpmndiagram.bpmn index 282503213..8b9bd0110 100644 --- a/test/spec/features/drilldown/missing-di-bpmndiagram-plane.bpmn +++ b/test/spec/features/drilldown/subprocess-missing-bpmndiagram.bpmn @@ -1,17 +1,13 @@ - + - - - + - + - - - + \ No newline at end of file diff --git a/test/spec/features/drilldown/subprocess-missing-di.bpmn b/test/spec/features/drilldown/subprocess-missing-di.bpmn new file mode 100644 index 000000000..1c5b4a9b2 --- /dev/null +++ b/test/spec/features/drilldown/subprocess-missing-di.bpmn @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file