Skip to content

Commit 578591b

Browse files
committed
Fix the chronik service tests
1 parent 0de5060 commit 578591b

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

tests/unittests/chronikService.test.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
ChronikBlockchainClient,
99
multiBlockchainClient
1010
} from '../../services/chronikService'
11-
import { Address } from '@prisma/client'
11+
import { Address, Prisma } from '@prisma/client'
1212
import { fetchAddressesArray } from '../../services/addressService'
1313
import { fetchUnconfirmedTransactions, deleteTransactions, upsertTransaction } from '../../services/transactionService'
1414
import { executeAddressTriggers } from '../../services/triggerService'
@@ -1403,14 +1403,22 @@ describe('WS onMessage matrix (no re-mocks)', () => {
14031403
.mockReturnValue(['ecash:qqkv9wr69ry2p9l53lxp635va4h86wv435995w8p2h'])
14041404

14051405
// minimal transaction shape for downstream
1406+
// Note: getTransactionFromChronikTransaction is now synchronous, so use mockReturnValue
14061407
jest.spyOn(client, 'getTransactionFromChronikTransaction')
1407-
.mockResolvedValue({
1408+
.mockReturnValue({
14081409
hash: 'txCONF',
1409-
amount: '0.01',
1410+
amount: new Prisma.Decimal('0.01'),
14101411
timestamp: Math.floor(Date.now() / 1000),
14111412
addressId: 'addr-1',
1412-
confirmed: false,
1413-
opReturn: JSON.stringify({ message: { type: 'PAY', paymentId: 'pid-1' } })
1413+
confirmed: true,
1414+
orphaned: false,
1415+
opReturn: JSON.stringify({ message: { type: 'PAY', paymentId: 'pid-1' } }),
1416+
inputs: {
1417+
create: []
1418+
},
1419+
outputs: {
1420+
create: []
1421+
}
14141422
})
14151423

14161424
const paySpy = jest.spyOn(client, 'handleUpdateClientPaymentStatus')

0 commit comments

Comments
 (0)