Skip to content

Commit 8b73309

Browse files
committed
Update tests and docs
1 parent 5cb03c7 commit 8b73309

32 files changed

+2898
-1601
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# Runs the tests, including integration
3333
test:
3434
docker:
35-
- image: circleci/node:11.10.1
35+
- image: circleci/node:14.2.0
3636
- image: camunda/zeebe:0.23.1
3737
working_directory: ~/zeebe-client-node-js
3838
steps:

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ docs
55
.vscode
66
cctest.ts
77
t.ts
8-
yolo.bpmn
8+
yolo.bpmn
9+
crash-*.log

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const { ZBClient, Duration } = require('zeebe-node')
204204

205205
const zbc = new ZBClient(gatewayAddress, {
206206
retry: true,
207-
maxRetries: 50,
207+
maxRetries: -1, // infinite retries
208208
maxRetryTimeout: Duration.seconds.of(5)
209209
})
210210
```

jest.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
preset: 'ts-jest',
3-
testEnvironment: 'node',
4-
testPathIgnorePatterns: ['node_modules', 'dist']
5-
};
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
testPathIgnorePatterns: ['node_modules', 'dist'],
5+
}

src/__tests__/BpmnParser.spec.ts

+60-65
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,65 @@ const testBpmnFile = __dirname + '/testdata/BpmnParser2.bpmn'
44
const simpleTestBpmnFile = __dirname + '/testdata/BpmnParser.bpmn'
55
const modeller7File = __dirname + '/testdata/modeller7File.bpmn'
66

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`
5366
)
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)
7368
})

0 commit comments

Comments
 (0)