Skip to content

Commit

Permalink
test(camunda8): align with createProcessInstance endpoint
Browse files Browse the repository at this point in the history
504 on timeout, processDefinitionKey
  • Loading branch information
jwulf committed Sep 22, 2024
1 parent 0e7d398 commit af9a744
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/__tests__/c8/rest/createProcess.rest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path'
import { C8RestClient } from '../../../c8/lib/C8RestClient'
import { LosslessDto } from '../../../lib'

jest.setTimeout(30000)
jest.setTimeout(17000)

let bpmnProcessId: string
let processDefinitionKey: string
Expand All @@ -29,7 +29,7 @@ test('Can create a process from bpmn id', (done) => {
},
})
.then((res) => {
expect(res.processKey).toEqual(processDefinitionKey)
expect(res.processDefinitionKey).toEqual(processDefinitionKey)
done()
})
})
Expand All @@ -43,7 +43,7 @@ test('Can create a process from process definition key', (done) => {
},
})
.then((res) => {
expect(res.processKey).toEqual(processDefinitionKey)
expect(res.processDefinitionKey).toEqual(processDefinitionKey)
done()
})
})
Expand All @@ -55,7 +55,7 @@ test('Can create a process with a lossless Dto', (done) => {
variables: new myVariableDto({ someNumberField: 8 }),
})
.then((res) => {
expect(res.processKey).toEqual(processDefinitionKey)
expect(res.processDefinitionKey).toEqual(processDefinitionKey)
done()
})
})
Expand All @@ -69,7 +69,7 @@ test('Can create a process and get the result', (done) => {
outputVariablesDto: myVariableDto,
})
.then((res) => {
expect(res.processKey).toEqual(processDefinitionKey)
expect(res.processDefinitionKey).toEqual(processDefinitionKey)
expect(res.variables.someNumberField).toBe(8)
done()
})
Expand All @@ -82,7 +82,7 @@ test('Can create a process and get the result', (done) => {
variables: new myVariableDto({ someNumberField: 9 }),
})
.then((res) => {
expect(res.processKey).toEqual(processDefinitionKey)
expect(res.processDefinitionKey).toEqual(processDefinitionKey)
// Without an outputVariablesDto, the response variables will be of type unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect((res.variables as any).someNumberField).toBe(9)
Expand All @@ -95,12 +95,11 @@ test('What happens if we time out?', async () => {
path.join('.', 'src', '__tests__', 'testdata', 'hello-world-complete.bpmn'),
])
const bpmnProcessId = res.processes[0].bpmnProcessId
// @TODO: we should get a 504 Gateway Timeout for this, not a 500
await expect(
restClient.createProcessInstanceWithResult({
bpmnProcessId,
variables: new myVariableDto({ someNumberField: 9 }),
requestTimeout: 20000,
})
).rejects.toThrow('500')
).rejects.toThrow('504')
})
2 changes: 1 addition & 1 deletion src/__tests__/c8/rest/deleteResource.rest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('It can delete a resource', async () => {
bpmnProcessId: id,
variables: {},
})
expect(wfi.processKey).toBe(key)
expect(wfi.processDefinitionKey).toBe(key)
await c8.deleteResource({ resourceKey: key })
// After deleting the process definition, we should not be able to start a new process instance.
await expect(
Expand Down
2 changes: 1 addition & 1 deletion src/c8/lib/C8Dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class CreateProcessInstanceResponse<T = Record<string, never>> {
* in the DeployResourceResponse message)
*/
@Int64String
readonly processKey!: string
readonly processDefinitionKey!: string
/**
* The BPMN process ID of the process definition
*/
Expand Down

0 comments on commit af9a744

Please sign in to comment.