@@ -4,70 +4,65 @@ const testBpmnFile = __dirname + '/testdata/BpmnParser2.bpmn'
4
4
const simpleTestBpmnFile = __dirname + '/testdata/BpmnParser.bpmn'
5
5
const modeller7File = __dirname + '/testdata/modeller7File.bpmn'
6
6
7
- describe ( 'parseBpmn' , ( ) => {
8
- const parsed = BpmnParser . parseBpmn ( testBpmnFile )
9
- const parsedSimple = BpmnParser . parseBpmn ( simpleTestBpmnFile )
10
- describe ( 'parseBpmn' , ( ) => {
11
- it ( 'parses a bpmn file to an Object' , ( ) => {
12
- expect ( typeof parsed ) . toBe ( 'object' )
13
- expect ( typeof parsedSimple ) . toBe ( 'object' )
14
- } )
15
- it ( 'can parse a file with a message with no name' , async ( ) => {
16
- const parsedv7 = await BpmnParser . generateConstantsForBpmnFiles (
17
- modeller7File
18
- )
19
- // console.log(parsedv7)
20
- expect ( typeof parsedv7 ) . toBe ( 'string' )
21
- } )
22
- } )
23
- describe ( 'getTaskTypes' , ( ) => {
24
- it ( 'gets a unique list of task types when passed an object' , async ( ) => {
25
- const taskTypes = await BpmnParser . getTaskTypes ( parsed )
26
- expect ( taskTypes . length ) . toBe ( 2 )
27
- } )
28
- it ( 'gets a list of unique task types when passed an array' , async ( ) => {
29
- const taskTypes = await BpmnParser . getTaskTypes ( [
30
- parsed ,
31
- parsedSimple ,
32
- ] )
33
- expect ( taskTypes . length ) . toBe ( 3 )
34
- } )
35
- } )
36
- describe ( 'getMessageNames' , ( ) => {
37
- it ( 'gets a list of unique message names when passed an object' , async ( ) => {
38
- const messageNames = await BpmnParser . getMessageNames ( parsed )
39
- expect ( messageNames . length ) . toBe ( 2 )
40
- } )
41
- it ( 'gets a list of unique message names when passed an array' , async ( ) => {
42
- const messageNames = await BpmnParser . getMessageNames ( [
43
- parsed ,
44
- parsedSimple ,
45
- ] )
46
- expect ( messageNames . length ) . toBe ( 3 )
47
- } )
48
- } )
49
- describe ( 'generateConstantsForBpmnFiles' , ( ) => {
50
- it ( 'Returns a constants file for a single Bpmn file' , async ( ) => {
51
- const constants = await BpmnParser . generateConstantsForBpmnFiles (
52
- testBpmnFile
7
+ const parsed = BpmnParser . parseBpmn ( testBpmnFile )
8
+ const parsedSimple = BpmnParser . parseBpmn ( simpleTestBpmnFile )
9
+
10
+ test ( 'parses a bpmn file to an Object' , ( ) => {
11
+ expect ( typeof parsed ) . toBe ( 'object' )
12
+ expect ( typeof parsedSimple ) . toBe ( 'object' )
13
+ } )
14
+
15
+ test ( 'can parse a file with a message with no name' , async ( ) => {
16
+ const parsedv7 = await BpmnParser . generateConstantsForBpmnFiles (
17
+ modeller7File
18
+ )
19
+ // console.log(parsedv7)
20
+ expect ( typeof parsedv7 ) . toBe ( 'string' )
21
+ } )
22
+
23
+ test ( 'gets a unique list of task types when passed an object' , async ( ) => {
24
+ const taskTypes = await BpmnParser . getTaskTypes ( parsed )
25
+ expect ( taskTypes . length ) . toBe ( 2 )
26
+ } )
27
+
28
+ test ( 'gets a list of unique task types when passed an array' , async ( ) => {
29
+ const taskTypes = await BpmnParser . getTaskTypes ( [ parsed , parsedSimple ] )
30
+ expect ( taskTypes . length ) . toBe ( 3 )
31
+ } )
32
+
33
+ test ( 'gets a list of unique message names when passed an object' , async ( ) => {
34
+ const messageNames = await BpmnParser . getMessageNames ( parsed )
35
+ expect ( messageNames . length ) . toBe ( 2 )
36
+ } )
37
+
38
+ test ( 'gets a list of unique message names when passed an array' , async ( ) => {
39
+ const messageNames = await BpmnParser . getMessageNames ( [
40
+ parsed ,
41
+ parsedSimple ,
42
+ ] )
43
+ expect ( messageNames . length ) . toBe ( 3 )
44
+ } )
45
+
46
+ test ( 'Returns a constants file for a single Bpmn file' , async ( ) => {
47
+ const constants = await BpmnParser . generateConstantsForBpmnFiles (
48
+ testBpmnFile
49
+ )
50
+ expect ( constants . indexOf ( 'console-log' ) ) . not . toBe ( - 1 )
51
+ } )
52
+
53
+ test ( 'Returns a constants file for an array of Bpmn files' , async ( ) => {
54
+ const constants = await BpmnParser . generateConstantsForBpmnFiles ( [
55
+ testBpmnFile ,
56
+ simpleTestBpmnFile ,
57
+ ] )
58
+ expect (
59
+ constants
60
+ . split ( ' ' )
61
+ . join ( '' )
62
+ . split ( '\n' )
63
+ . join ( '' )
64
+ . indexOf (
65
+ `exportenumMessageName{MSG_EMIT_FRAME="MSG-EMIT_FRAME",MSG_EMIT_FRAME_1="MSG-EMIT_FRAME`
53
66
)
54
- expect ( constants . indexOf ( 'console-log' ) ) . not . toBe ( - 1 )
55
- } )
56
- it ( 'Returns a constants file for an array of Bpmn files' , async ( ) => {
57
- const constants = await BpmnParser . generateConstantsForBpmnFiles ( [
58
- testBpmnFile ,
59
- simpleTestBpmnFile ,
60
- ] )
61
- expect (
62
- constants
63
- . split ( ' ' )
64
- . join ( '' )
65
- . split ( '\n' )
66
- . join ( '' )
67
- . indexOf (
68
- `exportenumMessageName{MSG_EMIT_FRAME="MSG-EMIT_FRAME",MSG_EMIT_FRAME_1="MSG-EMIT_FRAME`
69
- )
70
- ) . not . toBe ( - 1 )
71
- } )
72
- } )
67
+ ) . not . toBe ( - 1 )
73
68
} )
0 commit comments