Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
HYP-13: and another event from last project.
Browse files Browse the repository at this point in the history
  • Loading branch information
n3op2 committed Nov 16, 2023
1 parent 8498050 commit 3a07ccb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/indexer/__tests__/fixtures/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const complexEvent: ProcessRanEvent = {
inputs: [1, 2, 3],
outputs: [4, 5, 6],
process: {
id: 'demand-create',
id: 'example-create',
version: 1,
},
sender: 'alice',
Expand All @@ -18,7 +18,7 @@ export const noInputsOutputs: ProcessRanEvent = {
inputs: [],
outputs: [],
process: {
id: 'demand-create',
id: 'example-create',
version: 1,
},
sender: 'alice',
Expand Down
6 changes: 3 additions & 3 deletions src/lib/indexer/__tests__/handleEvent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('EventHandler', function () {
const result = await eventHandler.handleEvent(noInputsOutputs, {})
expect(result).to.deep.equal({})

const stub = eventProcessors['demand-create'] as SinonStub
const stub = eventProcessors['example-create'] as SinonStub
expect(stub.calledOnce).to.equal(true)
expect(stub.firstCall.args).to.deep.equal([1, tx, 'alice', [], []])
})
Expand All @@ -59,7 +59,7 @@ describe('EventHandler', function () {
const result = await eventHandler.handleEvent(complexEvent, {})
expect(result).to.deep.equal({})

const stub = eventProcessors['demand-create'] as SinonStub
const stub = eventProcessors['example-create'] as SinonStub
expect(stub.calledOnce).to.equal(true)
expect(stub.firstCall.args).to.deep.equal([
1,
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('EventHandler', function () {
const result = await eventHandler.handleEvent(complexEvent, baseChangeSet)
expect(result).to.deep.equal(baseChangeSet)

const stub = eventProcessors['demand-create'] as SinonStub
const stub = eventProcessors['example-create'] as SinonStub
expect(stub.calledOnce).to.equal(true)
expect(stub.firstCall.args).to.deep.equal([
1,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/indexer/eventProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const attachmentPayload = (map: Map<string, string>, key: string): AttachmentRec

const DefaultEventProcessors: EventProcessors = {
'example-create': (version, transaction, _sender, _inputs, outputs) => {
if (version !== 1) throw new Error(`Incompatible version ${version} for demand-create process`)
if (version !== 1) throw new Error(`Incompatible version ${version} for example-create process`)

const newDemandId = outputs[0].id
const newDemand = outputs[0]
Expand Down

0 comments on commit 3a07ccb

Please sign in to comment.