Skip to content

Commit

Permalink
test(mojaloop/#3819): prepare handler testing (#1004)
Browse files Browse the repository at this point in the history
* test(mojaloop/#3819): prepare handler testing

* dep

* audit

* reconcile to one file due to producer bug #3067

* address comments
  • Loading branch information
kleyow authored Apr 22, 2024
1 parent 4218622 commit d917f00
Show file tree
Hide file tree
Showing 8 changed files with 498 additions and 117 deletions.
2 changes: 0 additions & 2 deletions .nycrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ exclude: [
'**/bulk*/**',
'src/shared/logger/**',
'src/shared/constants.js',
'src/handlers/transfers/createRemittanceEntity.js',
'src/models/fxTransfer/**'
]
119 changes: 28 additions & 91 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,27 @@
"dependencies": {
"@hapi/catbox-memory": "6.0.1",
"@hapi/good": "9.0.1",
"@hapi/hapi": "21.3.8",
"@hapi/hapi": "21.3.9",
"@hapi/inert": "7.1.0",
"@hapi/joi": "17.1.1",
"@hapi/vision": "7.0.3",
"@mojaloop/database-lib": "11.0.3",
"@mojaloop/database-lib": "11.0.5",
"@mojaloop/central-services-error-handling": "13.0.0",
"@mojaloop/central-services-health": "15.0.0",
"@mojaloop/central-services-logger": "11.3.0",
"@mojaloop/central-services-metrics": "12.0.8",
"@mojaloop/central-services-shared": "18.2.1-snapshot.1",
"@mojaloop/central-services-stream": "11.2.4",
"@mojaloop/event-sdk": "14.0.1",
"@mojaloop/event-sdk": "14.0.2",
"@mojaloop/ml-number": "11.2.3",
"@mojaloop/object-store-lib": "12.0.2",
"@mojaloop/object-store-lib": "12.0.3",
"@now-ims/hapi-now-auth": "2.1.0",
"ajv": "8.12.0",
"ajv-keywords": "5.1.0",
"base64url": "3.0.1",
"blipp": "4.0.2",
"commander": "12.0.0",
"cron": "3.1.6",
"cron": "3.1.7",
"decimal.js": "10.4.3",
"docdash": "2.0.2",
"event-stream": "4.0.1",
Expand Down
2 changes: 0 additions & 2 deletions src/handlers/transfers/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ const savePreparedRequest = async ({ validationPassed, reasons, payload, isFx, f
const definePositionParticipant = async ({ isFx, payload }) => {
const cyrilResult = await createRemittanceEntity(isFx)
.getPositionParticipant(payload)

const account = await Participant.getAccountByNameAndCurrency(
cyrilResult.participantName,
cyrilResult.currencyId,
Expand Down Expand Up @@ -223,7 +222,6 @@ const prepare = async (error, messages) => {
await savePreparedRequest({
validationPassed, reasons, payload, isFx, functionality, params, location
})

if (!validationPassed) {
logger.error(Util.breadcrumb(location, { path: 'validationFailed' }))
const fspiopError = createFSPIOPError(FSPIOPErrorCodes.VALIDATION_ERROR, reasons.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,6 @@ const prepareTestData = async (dataObj) => {
payeeList.push(payee)
}

const kafkacat = 'GROUP=abc; T=topic; TR=transfer; kafkacat -b localhost -G $GROUP $T-$TR-prepare $T-$TR-position $T-$TR-position-batch $T-$TR-fulfil $T-$TR-get $T-admin-$TR $T-notification-event $T-bulk-prepare'
if (debug) console.error(kafkacat)

// Create payloads for number of transfers
const transfersArray = []
for (let i = 0; i < dataObj.transfers.length; i++) {
Expand Down
3 changes: 0 additions & 3 deletions test/integration-override/handlers/transfers/handlers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ const prepareTestData = async (dataObj) => {
const payer = await ParticipantHelper.prepareData(dataObj.payer.name, dataObj.amount.currency)
const payee = await ParticipantHelper.prepareData(dataObj.payee.name, dataObj.amount.currency)

const kafkacat = 'GROUP=abc; T=topic; TR=transfer; kafkacat -b localhost -G $GROUP $T-$TR-prepare $T-$TR-position $T-$TR-fulfil $T-$TR-get $T-admin-$TR $T-notification-event $T-bulk-prepare'
if (debug) console.error(kafkacat)

const payerLimitAndInitialPosition = await ParticipantLimitHelper.prepareLimitAndInitialPosition(payer.participant.name, {
currency: dataObj.amount.currency,
limit: { value: dataObj.payer.limit }
Expand Down
Loading

0 comments on commit d917f00

Please sign in to comment.