Skip to content

Commit

Permalink
Add tests for built none event
Browse files Browse the repository at this point in the history
  • Loading branch information
csouchet committed Sep 28, 2023
1 parent fe34537 commit 4c9b3e2
Showing 1 changed file with 51 additions and 15 deletions.
66 changes: 51 additions & 15 deletions test/unit/helpers/JsonBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1941,21 +1941,6 @@ describe('build json', () => {
});
});

it(`not possible to have eventDefinitionOn=NONE with defined eventDefinitionKind`, () => {
expect(() => {
buildDefinitions({
process: {
event: [
{
bpmnKind,
eventDefinitionParameter: { eventDefinitionKind: 'message', eventDefinitionOn: EventDefinitionOn.NONE },
},
],
},
});
}).toThrow("Must use another value than NONE for 'eventDefinitionOn' when 'eventDefinitionKind' is set !!");
});

it(`build json of definitions containing one process with ${bpmnKind} (with one messageEventDefinition, name & id)`, () => {
const json = buildDefinitions({
process: {
Expand Down Expand Up @@ -2422,6 +2407,57 @@ describe('build json', () => {
});
});

it(`build json of definitions containing one process with none ${bpmnKind}`, () => {
const json = buildDefinitions({
process: {
event: [
{
bpmnKind,
eventDefinitionParameter: { eventDefinitionOn: EventDefinitionOn.NONE },
},
],
},
});

expect(json).toEqual({
definitions: {
targetNamespace: '',
collaboration: { id: 'collaboration_id_0' },
process: {
id: '0',
[bpmnKind]: {
id: 'event_id_0_0',
},
},
BPMNDiagram: {
name: 'process 0',
BPMNPlane: {
BPMNShape: {
id: 'shape_event_id_0_0',
bpmnElement: 'event_id_0_0',
Bounds: { x: 362, y: 232, width: 36, height: 45 },
},
},
},
},
});
});

it(`not possible to have eventDefinitionOn=NONE with defined eventDefinitionKind`, () => {
expect(() => {
buildDefinitions({
process: {
event: [
{
bpmnKind,
eventDefinitionParameter: { eventDefinitionKind: 'message', eventDefinitionOn: EventDefinitionOn.NONE },
},
],
},
});
}).toThrow("Must use another value than NONE for 'eventDefinitionOn' when 'eventDefinitionKind' is set !!");
});

it(`incoming and outgoing for ${bpmnKind}`, () => {
const json = buildDefinitions({
process: {
Expand Down

0 comments on commit 4c9b3e2

Please sign in to comment.