Skip to content

Commit

Permalink
Change test names
Browse files Browse the repository at this point in the history
  • Loading branch information
csouchet committed Jul 22, 2020
1 parent 84dbb1c commit 187034b
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 239 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('parse bpmn as json for association', () => {
it.each([
['object', processJsonAsObjectWithAssociationJsonAsObject],
['array', [processJsonAsObjectWithAssociationJsonAsObject]],
])(`should convert as Edge, when a association is an attribute (as object) of 'process' (as %s)`, (title: string, processJson: TProcess | TProcess[]) => {
])(`should convert as Edge, when an association is an attribute (as object) of 'process' (as %s)`, (title: string, processJson: TProcess | TProcess[]) => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('parse bpmn as json for association', () => {
});
});

it('json containing one process with an array of associations with/without name', () => {
it(`should convert as Edge, when an association (with/without name) is an attribute (as array) of 'process'`, () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down
113 changes: 55 additions & 58 deletions test/unit/component/parser/json/BpmnJsonParser.label.bounds.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import { parseJsonAndExpectOnlyEdges, parseJsonAndExpectOnlyFlowNodes, verifyLabelBounds } from './JsonTestUtils';
import each from 'jest-each';
import { TProcess } from '../../../../../src/component/parser/xml/bpmn-json-model/baseElement/rootElement/rootElement';
import {ShapeBpmnElementKind} from "../../../../../src/model/bpmn/shape/ShapeBpmnElementKind";
import { ShapeBpmnElementKind } from '../../../../../src/model/bpmn/shape/ShapeBpmnElementKind';

describe('parse bpmn as json for label bounds', () => {
each([
Expand All @@ -30,7 +30,6 @@ describe('parse bpmn as json for label bounds', () => {
['callActivity'],
['subProcess'],
['textAnnotation'],
['callActivity'],
// TODO: To uncomment when we support complex gateway
//['complexGateway'],
// TODO: To uncomment when we support manualTask
Expand All @@ -41,38 +40,68 @@ describe('parse bpmn as json for label bounds', () => {
//['sendTask'],
// TODO: To uncomment when we support businessRuleTask
//['businessRuleTask'],
]).it('json containing a BPMNShape which has a label with bounds with all attributes in a %s', sourceKind => {
const json = {
definitions: {
targetNamespace: '',
process: {
id: 'Process_1',
]).describe('parse bpmn as json for label bounds on %s', sourceKind => {
it(`should convert as Shape, when a BPMNShape (attached to ${sourceKind} & with bounds with all attributes) is an attribute (as object) of 'BPMNPlane' (as object)`, () => {
const json = {
definitions: {
targetNamespace: '',
process: {
id: 'Process_1',
},
BPMNDiagram: {
id: 'BpmnDiagram_1',
BPMNPlane: {
id: 'BpmnPlane_1',
BPMNShape: {
id: 'shape_source_id_0',
bpmnElement: 'source_id_0',
Bounds: { x: 362, y: 232, width: 36, height: 45 },
BPMNLabel: {
id: 'label_id',
Bounds: { x: 25, y: 26, width: 27, height: 28 },
},
},
},
},
},
BPMNDiagram: {
id: 'BpmnDiagram_1',
BPMNPlane: {
id: 'BpmnPlane_1',
BPMNShape: {
id: 'shape_source_id_0',
bpmnElement: 'source_id_0',
Bounds: { x: 362, y: 232, width: 36, height: 45 },
BPMNLabel: {
id: 'label_id',
Bounds: { x: 25, y: 26, width: 27, height: 28 },
};
(json.definitions.process as TProcess)[`${sourceKind}`] = { id: 'source_id_0', name: `${sourceKind}_id_0` };

const model = parseJsonAndExpectOnlyFlowNodes(json, 1);

verifyLabelBounds(model.flowNodes[0].label, { x: 25, y: 26, width: 27, height: 28 });
});

it(`should convert as Shape, when a BPMNShape (attached to ${sourceKind} & without bounds) is an attribute (as object) of 'BPMNPlane' (as object)`, () => {
const json = {
definitions: {
targetNamespace: '',
process: {},
BPMNDiagram: {
id: 'BpmnDiagram_1',
BPMNPlane: {
id: 'BpmnPlane_1',
BPMNShape: {
id: 'BPMNShape_id_0',
bpmnElement: 'source_id_0',
Bounds: { x: 362, y: 232, width: 36, height: 45 },
BPMNLabel: {
id: 'label_id',
},
},
},
},
},
},
};
(json.definitions.process as TProcess)[`${sourceKind}`] = { id: 'source_id_0', name: `${sourceKind}_id_0` };
};
(json.definitions.process as TProcess)[`${sourceKind}`] = { id: 'source_id_0', name: `${sourceKind}_id_0` };

const model = parseJsonAndExpectOnlyFlowNodes(json, 1);
const model = parseJsonAndExpectOnlyFlowNodes(json, 1);

verifyLabelBounds(model.flowNodes[0].label, { x: 25, y: 26, width: 27, height: 28 });
expect(model.flowNodes[0].label).toBeUndefined();
});
});

it('json containing a BPMNEdge which has a label with bounds with all attributes', () => {
it(`should convert as Edge, when a BPMNEdge (with bounds with all attributes) is an attribute (as object) of 'BPMNPlane' (as object)`, () => {
const json = {
definitions: {
targetNamespace: '',
Expand All @@ -99,39 +128,7 @@ describe('parse bpmn as json for label bounds', () => {
verifyLabelBounds(model.edges[0].label, { x: 25, y: 26, width: 27, height: 28 });
});

it('json containing a BPMNShape which has a label without bounds', () => {
const json = {
definitions: {
targetNamespace: '',
process: {
task: {
id: 'task_id_0',
name: 'task name',
},
},
BPMNDiagram: {
id: 'BpmnDiagram_1',
BPMNPlane: {
id: 'BpmnPlane_1',
BPMNShape: {
id: 'BPMNShape_id_0',
bpmnElement: 'task_id_0',
Bounds: { x: 362, y: 232, width: 36, height: 45 },
BPMNLabel: {
id: 'label_id',
},
},
},
},
},
};

const model = parseJsonAndExpectOnlyFlowNodes(json, 1);

expect(model.flowNodes[0].label).toBeUndefined();
});

it('json containing a BPMNEdge which has a label without bounds', () => {
it(`should convert as Edge, when a BPMNEdge (without bounds) is an attribute (as object) of 'BPMNPlane' (as object)`, () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down
82 changes: 42 additions & 40 deletions test/unit/component/parser/json/BpmnJsonParser.label.font.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ describe('parse bpmn as json for label font', () => {
['callActivity'],
['subProcess'],
['textAnnotation'],
['callActivity'],
// TODO: To uncomment when we support complex gateway
//['complexGateway'],
// TODO: To uncomment when we support manualTask
Expand All @@ -46,45 +45,48 @@ describe('parse bpmn as json for label font', () => {
//['sendTask'],
// TODO: To uncomment when we support businessRuleTask
//['businessRuleTask'],
]).it('json containing a BPMNShape who references a label style with font in a %s', sourceKind => {
const json = {
definitions: {
targetNamespace: '',
process: {
id: 'Process_1',
},
BPMNDiagram: {
id: 'BpmnDiagram_1',
BPMNPlane: {
id: 'BpmnPlane_1',
BPMNShape: {
id: 'shape_source_id_0',
bpmnElement: 'source_id_0',
Bounds: { x: 362, y: 232, width: 36, height: 45 },
BPMNLabel: {
id: 'label_id',
labelStyle: 'style_id',
]).it(
"should convert as Shape with Font, when a BPMNShape (attached to %s & who references a BPMNLabelStyle with font) is an attribute (as object) of 'BPMNPlane' (as object)",
sourceKind => {
const json = {
definitions: {
targetNamespace: '',
process: {
id: 'Process_1',
},
BPMNDiagram: {
id: 'BpmnDiagram_1',
BPMNPlane: {
id: 'BpmnPlane_1',
BPMNShape: {
id: 'shape_source_id_0',
bpmnElement: 'source_id_0',
Bounds: { x: 362, y: 232, width: 36, height: 45 },
BPMNLabel: {
id: 'label_id',
labelStyle: 'style_id',
},
},
},
},
BPMNLabelStyle: {
id: 'style_id',
Font: {
name: 'Arial',
size: 11.0,
BPMNLabelStyle: {
id: 'style_id',
Font: {
name: 'Arial',
size: 11.0,
},
},
},
},
},
};
(json.definitions.process as TProcess)[`${sourceKind}`] = { id: 'source_id_0', name: `${sourceKind}_id_0` };
};
(json.definitions.process as TProcess)[`${sourceKind}`] = { id: 'source_id_0', name: `${sourceKind}_id_0` };

const model = parseJsonAndExpectOnlyFlowNodes(json, 1);
const model = parseJsonAndExpectOnlyFlowNodes(json, 1);

verifyLabelFont(model.flowNodes[0].label, { name: 'Arial', size: 11.0 });
});
verifyLabelFont(model.flowNodes[0].label, { name: 'Arial', size: 11.0 });
},
);

it('json containing a BPMNEdge who references a label style with font', () => {
it("should convert as Edge with Font, when a BPMNEdge (who references a BPMNLabelStyle with font) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -118,7 +120,7 @@ describe('parse bpmn as json for label font', () => {
verifyLabelFont(model.edges[0].label, { name: 'Arial', size: 11.0 });
});

it('json containing several BPMNShapes who reference the same label style', () => {
it("should convert as Shape[] with Font, when several BPMNShapes (who reference the same BPMNLabelStyle) are an attribute (as array) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -172,7 +174,7 @@ describe('parse bpmn as json for label font', () => {
verifyLabelFont(model.flowNodes[1].label, { name: 'Arial', size: 11.0 });
});

it('json containing several BPMNEdges who reference the same label style', () => {
it("should convert as Edge[] with Font, when several BPMNEdges (who reference the same BPMNLabelStyle) are an attribute (as array) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -215,7 +217,7 @@ describe('parse bpmn as json for label font', () => {
verifyLabelFont(model.edges[1].label, { name: 'Arial', size: 11.0 });
});

it('json containing an array of label styles and BPMNShapes who reference a label style with font with/without all attributes', () => {
it("should convert as Shape[] without Font, when BPMNShapes (who reference a BPMNLabelStyle) are an attribute (as array) of 'BPMNPlane' (as object) & BPMNLabelStyle (with font with/without all attributes) is an attribute (as array) of 'BPMNDiagram' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -282,7 +284,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.flowNodes[1].label).toBeUndefined();
});

it('json containing an array of label styles and BPMNEdges who reference a label style with font with/without all attributes', () => {
it("should convert as Edge[] without Font, when BPMNEdges (who reference a BPMNLabelStyle) are an attribute (as array) of 'BPMNPlane' (as object) & BPMNLabelStyle (with font with/without all attributes) is an attribute (as array) of 'BPMNDiagram' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -338,7 +340,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.edges[1].label).toBeUndefined();
});

it('json containing a BPMNShape who references a label style without font', () => {
it("should convert as Shape without Font, when a BPMNShape (who references a BPMNLabelStyle without font) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -374,7 +376,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.flowNodes[0].label).toBeUndefined();
});

it('json containing a BPMNEdge who references a label style without font', () => {
it("should convert as Edge without Font, when a BPMNEdge (who references a BPMNLabelStyle without font) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -404,7 +406,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.edges[0].label).toBeUndefined();
});

it('json containing a BPMNShape who references a non-existing label style', () => {
it("should convert as Shape without Font, when a BPMNShape (who references a non-existing BPMNLabelStyle) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
console.warn = jest.fn();
const json = {
definitions: {
Expand Down Expand Up @@ -439,7 +441,7 @@ describe('parse bpmn as json for label font', () => {
expect(console.warn).toHaveBeenCalledWith('Unable to assign font from style %s to shape/edge %s', 'non-existing_style_id', 'BPMNShape_id_0');
});

it('json containing a BPMNEdge who references a non-existing label style', () => {
it("should convert as Edge without Font, when a BPMNEdge (who references a non-existing BPMNLabelStyle) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
console.warn = jest.fn();
const json = {
definitions: {
Expand Down
13 changes: 6 additions & 7 deletions test/unit/component/parser/json/BpmnJsonParser.label.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ describe('parse bpmn as json for label font', () => {
['callActivity'],
['subProcess'],
['textAnnotation'],
['callActivity'],
// TODO: To uncomment when we support complex gateway
//['complexGateway'],
// TODO: To uncomment when we support manualTask
Expand All @@ -40,7 +39,7 @@ describe('parse bpmn as json for label font', () => {
//['sendTask'],
// TODO: To uncomment when we support businessRuleTask
//['businessRuleTask'],
]).it('json containing a BPMNShape with empty label in a %s', sourceKind => {
]).it("should convert as Shape without Label, when a BPMNShape (attached to %s & with empty BPMNLabel) is an attribute (as object) of 'BPMNPlane' (as object)", sourceKind => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -68,7 +67,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.flowNodes[0].label).toBeUndefined();
});

it('json containing a BPMNEdge with empty label', () => {
it("should convert as Edge without Label, when a BPMNEdge (with empty BPMNLabel) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand All @@ -92,7 +91,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.edges[0].label).toBeUndefined();
});

it('json containing a BPMNShape with label with just id', () => {
it("should convert as Shape without Label, when a BPMNShape (with BPMNLabel with just id) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -124,7 +123,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.flowNodes[0].label).toBeUndefined();
});

it('json containing a BPMNEdge with empty label with just id', () => {
it("should convert as Edge without Label, when a BPMNEdge (with BPMNLabel with just id) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand All @@ -150,7 +149,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.edges[0].label).toBeUndefined();
});

it('json containing a BPMNShape without label', () => {
it("should convert as Shape without Label, when a BPMNShape (without BPMNLabel) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down Expand Up @@ -179,7 +178,7 @@ describe('parse bpmn as json for label font', () => {
expect(model.flowNodes[0].label).toBeUndefined();
});

it('json containing a BPMNEdge without label', () => {
it("should convert as Edge without Label, when a BPMNEdge (without BPMNLabel) is an attribute (as object) of 'BPMNPlane' (as object)", () => {
const json = {
definitions: {
targetNamespace: '',
Expand Down
Loading

0 comments on commit 187034b

Please sign in to comment.