Skip to content

Commit

Permalink
fix: update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan committed Feb 9, 2024
1 parent 8dd615a commit 447fb9c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/execute/execute.processor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ const subnetMock = { endpointWs: 'ws://endpoint/ws' }
const providerMock = Object.assign(new EventEmitter(), {
getCode: jest.fn().mockResolvedValue('0x123'),
})
const walletMock = {}
const transactionMock = { wait: jest.fn(() => Promise.resolve({})) }
const transactionMock = {}
const transactionResponseMock = { wait: jest.fn().mockResolvedValue({}) }
const walletMock = {
sendTransaction: jest.fn().mockResolvedValue(transactionResponseMock),
}
const contractMock = {
execute: jest.fn().mockResolvedValue(transactionMock),
execute: {
populateTransaction: jest.fn().mockResolvedValue(transactionMock),
},
networkSubnetId: jest.fn().mockResolvedValue(''),
subnets: jest.fn().mockResolvedValue(subnetMock),
receiptRootToCertId: jest.fn().mockResolvedValue(''),
Expand Down Expand Up @@ -112,14 +117,18 @@ describe('ExecuteProcessor', () => {

expect(validExecuteJob.progress).toHaveBeenCalledWith(50)

expect(contractMock.execute).toHaveBeenCalledWith(
expect(contractMock.execute.populateTransaction).toHaveBeenCalledWith(
validExecuteJob.data.logIndexes,
validExecuteJob.data.receiptTrieRoot,
validExecuteJob.data.receiptTrieMerkleProof,
{
gasLimit: 4_000_000,
}
)

expect(walletMock.sendTransaction).toHaveBeenCalledWith(transactionMock)
expect(transactionResponseMock.wait).toHaveBeenCalled()

expect(validExecuteJob.progress).toHaveBeenCalledWith(100)
})
})
Expand Down

0 comments on commit 447fb9c

Please sign in to comment.