@mojaloop/central-ledger 9.2.2 → 15.1.3-snapshot.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/.circleci/config.yml +625 -204
  2. package/.env +3 -2
  3. package/.ncurc.yaml +9 -0
  4. package/.nvmrc +1 -1
  5. package/.versionrc +15 -0
  6. package/CHANGELOG.md +353 -0
  7. package/CODEOWNERS +31 -0
  8. package/Dockerfile +20 -14
  9. package/LICENSE.md +4 -4
  10. package/Onboarding.md +0 -7
  11. package/README.md +99 -22
  12. package/audit-resolve.json +136 -1
  13. package/config/default.json +82 -27
  14. package/docker/central-ledger/default.json +68 -21
  15. package/docker/ml-api-adapter/default.json +10 -1
  16. package/docker/wait-for/wait-for-objstore.sh +1 -6
  17. package/docker/wait-for/wait-for.env +1 -1
  18. package/docker-compose.integration.yml +8 -5
  19. package/docker-compose.yml +73 -16
  20. package/migrations/310203_transferParticipant-indexes.js +38 -0
  21. package/migrations/310503_participantLimit-indexes-composite.js +38 -0
  22. package/migrations/{400401_settlementWindowStateChange-indexes.js → 400401_settlmentWindowStateChange-indexes.js} +0 -0
  23. package/migrations/401301_settlementModel-indexes.js +2 -0
  24. package/migrations/500401_quote-hotfix-2719.js +58 -0
  25. package/migrations/500501_feature-fixSubIdRef.js +53 -0
  26. package/migrations/500601_party-2480.js +63 -0
  27. package/migrations/501001_quoteExtension-quote-service-174.js +46 -0
  28. package/migrations/501002_quoteExtension-2522.js +61 -0
  29. package/migrations/800101_feature-fixSubIdRef.js +90 -0
  30. package/migrations/910102_hotfix954.js +4 -1
  31. package/migrations/940100_quotePartyIdInfoExtension.js +52 -0
  32. package/migrations/940101_quotePartyIdInfoExtension-2522.js +64 -0
  33. package/migrations/950100_settlementContentAggregation-decimal184.js +40 -0
  34. package/migrations/950101_transferParticipantStateChange.js +46 -0
  35. package/migrations/950102_settlementModel-adjustPosition.js +42 -0
  36. package/migrations/950103_dropTransferParticipantStateChange.js +47 -0
  37. package/migrations/950104_settlementModel-settlementAccountTypeId.js +79 -0
  38. package/migrations/950106_unique_settlement_model_ledger_account_currency.js +38 -0
  39. package/migrations/950107_settlementWindowContent_foreign_settlementModel.js +60 -0
  40. package/package.json +99 -81
  41. package/scripts/_wait4_all.js +146 -0
  42. package/seeds/amountType.js +4 -6
  43. package/seeds/balanceOfPayments.js +4 -6
  44. package/seeds/bulkProcessingState.js +4 -6
  45. package/seeds/bulkTransferState.js +4 -6
  46. package/seeds/currency.js +4 -6
  47. package/seeds/endpointType.js +128 -7
  48. package/seeds/ledgerAccountType.js +11 -10
  49. package/seeds/ledgerEntryType.js +5 -7
  50. package/seeds/participant.js +4 -6
  51. package/seeds/participantLimitType.js +4 -6
  52. package/seeds/partyIdentifierType.js +4 -6
  53. package/seeds/partyType.js +4 -6
  54. package/seeds/settlementDelay.js +4 -6
  55. package/seeds/settlementGranularity.js +4 -6
  56. package/seeds/settlementInterchange.js +4 -6
  57. package/seeds/settlementState.js +4 -6
  58. package/seeds/settlementWindow1State.js +4 -6
  59. package/seeds/transactionInitiator.js +4 -6
  60. package/seeds/transactionInitiatorType.js +4 -6
  61. package/seeds/transactionScenario.js +4 -6
  62. package/seeds/transferParticipantRoleType.js +4 -6
  63. package/seeds/transferState.js +9 -6
  64. package/src/api/interface/swagger.json +728 -948
  65. package/src/api/ledgerAccountTypes/handler.js +55 -0
  66. package/src/api/ledgerAccountTypes/routes.js +63 -0
  67. package/src/api/metrics/handler.js +2 -2
  68. package/src/api/metrics/routes.js +1 -1
  69. package/src/api/participants/handler.js +43 -35
  70. package/src/api/participants/routes.js +13 -13
  71. package/src/api/root/routes.js +2 -2
  72. package/src/api/settlementModels/handler.js +9 -26
  73. package/src/api/settlementModels/routes.js +4 -4
  74. package/src/api/transactions/handler.js +46 -0
  75. package/src/api/transactions/routes.js +45 -0
  76. package/src/domain/bulkTransfer/index.js +6 -5
  77. package/src/domain/ledgerAccountTypes/index.js +58 -0
  78. package/src/domain/participant/index.js +55 -4
  79. package/src/domain/position/index.js +18 -2
  80. package/src/domain/settlement/index.js +39 -6
  81. package/src/domain/transactions/index.js +61 -0
  82. package/src/domain/transfer/index.js +22 -2
  83. package/src/domain/transfer/transform.js +3 -3
  84. package/src/handlers/admin/handler.js +24 -32
  85. package/src/handlers/bulk/fulfil/handler.js +89 -56
  86. package/src/handlers/bulk/get/handler.js +203 -0
  87. package/src/handlers/bulk/index.js +4 -1
  88. package/src/handlers/bulk/prepare/handler.js +30 -29
  89. package/src/handlers/bulk/processing/handler.js +61 -32
  90. package/src/handlers/bulk/shared/validator.js +13 -1
  91. package/src/handlers/index.js +18 -9
  92. package/src/handlers/positions/handler.js +67 -46
  93. package/src/handlers/register.js +7 -7
  94. package/src/handlers/timeouts/handler.js +9 -4
  95. package/src/handlers/transfers/handler.js +408 -182
  96. package/src/handlers/transfers/validator.js +41 -11
  97. package/src/lib/cache.js +8 -34
  98. package/src/lib/config.js +5 -7
  99. package/src/lib/enum.js +22 -22
  100. package/src/lib/enumCached.js +76 -0
  101. package/src/lib/healthCheck/subServiceHealth.js +2 -2
  102. package/src/lib/requestLogger.js +9 -9
  103. package/src/lib/urlParser.js +1 -1
  104. package/src/models/bulkTransfer/bulkTransfer.js +6 -6
  105. package/src/models/bulkTransfer/bulkTransferAssociation.js +3 -3
  106. package/src/models/bulkTransfer/bulkTransferDuplicateCheck.js +4 -4
  107. package/src/models/bulkTransfer/bulkTransferExtension.js +2 -2
  108. package/src/models/bulkTransfer/bulkTransferFulfilmentDuplicateCheck.js +4 -4
  109. package/src/models/bulkTransfer/bulkTransferStateChange.js +7 -7
  110. package/src/models/bulkTransfer/facade.js +54 -3
  111. package/src/models/bulkTransfer/individualTransfer.js +2 -2
  112. package/src/models/ilpPackets/ilpPacket.js +36 -0
  113. package/src/models/ledgerAccountType/ledgerAccountType.js +139 -3
  114. package/src/models/misc/migrationLock.js +1 -1
  115. package/src/models/misc/segment.js +1 -1
  116. package/src/models/participant/facade.js +226 -76
  117. package/src/models/participant/participant.js +6 -5
  118. package/src/models/participant/participantCached.js +8 -0
  119. package/src/models/participant/participantCurrency.js +7 -7
  120. package/src/models/participant/participantCurrencyCached.js +11 -1
  121. package/src/models/participant/participantLimit.js +13 -13
  122. package/src/models/participant/participantLimitCached.js +124 -0
  123. package/src/models/participant/participantPosition.js +34 -5
  124. package/src/models/participant/participantPositionChange.js +10 -2
  125. package/src/models/position/facade.js +112 -18
  126. package/src/models/position/participantPosition.js +6 -6
  127. package/src/models/settlement/settlementModel.js +92 -17
  128. package/src/models/settlement/settlementModelCached.js +139 -0
  129. package/src/models/transfer/facade.js +97 -32
  130. package/src/models/transfer/ilpPacket.js +4 -4
  131. package/src/models/transfer/transfer.js +7 -7
  132. package/src/models/transfer/transferDuplicateCheck.js +21 -5
  133. package/src/models/transfer/transferError.js +5 -5
  134. package/src/models/transfer/transferErrorDuplicateCheck.js +4 -4
  135. package/src/models/transfer/transferExtension.js +4 -4
  136. package/src/models/transfer/transferFulfilment.js +5 -5
  137. package/src/models/transfer/transferFulfilmentDuplicateCheck.js +4 -4
  138. package/src/models/transfer/transferParticipant.js +3 -3
  139. package/src/models/transfer/transferStateChange.js +11 -11
  140. package/src/models/transfer/transferTimeout.js +5 -5
  141. package/src/schema/bulkTransfer.js +4 -4
  142. package/src/shared/plugins.js +10 -9
  143. package/src/shared/setup.js +69 -46
  144. package/test/integration/domain/participant/index.test.js +2 -0
  145. package/test/integration/handlers/handlers.test.js +605 -166
  146. package/test/integration/handlers/root.test.js +1 -1
  147. package/test/integration/helpers/hubAccounts.js +62 -0
  148. package/test/integration/helpers/ilpPacket.js +1 -1
  149. package/test/integration/helpers/participantFundsInOut.js +80 -0
  150. package/test/integration/helpers/participantLimit.js +6 -1
  151. package/test/integration/helpers/settlementModels.js +88 -0
  152. package/test/integration/helpers/testConsumer.js +163 -0
  153. package/test/integration/helpers/testProducer.js +0 -1
  154. package/test/integration/helpers/transferDuplicateCheck.js +1 -1
  155. package/test/integration/helpers/transferStateChange.js +1 -1
  156. package/test/integration/helpers/transferTestHelper.js +3 -5
  157. package/test/integration/models/transfer/transferStateChange.test.js +6 -0
  158. package/test/unit/api/ledgerAccountTypes/handler.test.js +126 -0
  159. package/test/unit/api/ledgerAccountTypes/routes.test.js +52 -0
  160. package/test/unit/api/participants/handler.test.js +75 -33
  161. package/test/unit/api/root/handler.test.js +1 -1
  162. package/test/unit/api/root/routes.test.js +2 -2
  163. package/test/unit/api/settlementModels/handler.test.js +21 -57
  164. package/test/unit/api/transactions/handler.test.js +108 -0
  165. package/test/unit/api/transactions/routes.test.js +38 -0
  166. package/test/unit/domain/ledgerAccountTypes/index.test.js +197 -0
  167. package/test/unit/domain/participant/index.test.js +115 -2
  168. package/test/unit/domain/settlement/index.test.js +199 -29
  169. package/test/unit/domain/transactions/index.test.js +128 -0
  170. package/test/unit/domain/transfer/index.test.js +1 -0
  171. package/test/unit/domain/transfer/transform.test.js +2 -0
  172. package/test/unit/handlers/admin/handler.test.js +5 -5
  173. package/test/unit/handlers/bulk/get/handler.test.js +401 -0
  174. package/test/unit/handlers/index.test.js +6 -0
  175. package/test/unit/handlers/positions/handler.test.js +26 -0
  176. package/test/unit/handlers/register.test.js +2 -0
  177. package/test/unit/handlers/transfers/handler.test.js +491 -36
  178. package/test/unit/handlers/transfers/validator.test.js +31 -31
  179. package/test/unit/lib/cache.test.js +0 -64
  180. package/test/unit/lib/cachingOfEnums.test.js +121 -0
  181. package/test/unit/lib/config.test.js +34 -0
  182. package/test/unit/lib/enum.test.js +6 -1
  183. package/test/unit/lib/enumCached.test.js +82 -0
  184. package/test/unit/lib/healthCheck/subServiceHealth.test.js +2 -0
  185. package/test/unit/lib/requestLogger.test.js +14 -12
  186. package/test/unit/models/ilpPackets/ilpPacket.test.js +89 -0
  187. package/test/unit/models/ledgerAccountType/ledgerAccountType.test.js +255 -6
  188. package/test/unit/models/misc/migrationLock.test.js +4 -0
  189. package/test/unit/models/misc/segment.test.js +5 -0
  190. package/test/unit/models/participant/facade.test.js +493 -54
  191. package/test/unit/models/participant/participant.test.js +4 -0
  192. package/test/unit/models/participant/participantCurrency.test.js +22 -9
  193. package/test/unit/models/participant/participantCurrencyCached.test.js +1 -1
  194. package/test/unit/models/participant/participantLimit.test.js +97 -0
  195. package/test/unit/models/participant/participantLimitCached.test.js +232 -0
  196. package/test/unit/models/participant/participantPosition.test.js +217 -0
  197. package/test/unit/models/participant/participantPositionChange.test.js +3 -0
  198. package/test/unit/models/position/facade.test.js +318 -29
  199. package/test/unit/models/position/participantPosition.test.js +22 -7
  200. package/test/unit/models/settlement/settlementModel.test.js +18 -37
  201. package/test/unit/models/settlement/settlementModelCached.test.js +171 -0
  202. package/test/unit/models/transfer/facade.test.js +115 -0
  203. package/test/unit/models/transfer/ilpPacket.test.js +28 -11
  204. package/test/unit/models/transfer/transfer.test.js +13 -4
  205. package/test/unit/models/transfer/transferDuplicateCheck.test.js +4 -0
  206. package/test/unit/models/transfer/transferError.test.js +5 -1
  207. package/test/unit/models/transfer/transferErrorDuplicateCheck.test.js +4 -0
  208. package/test/unit/models/transfer/transferExtension.test.js +26 -9
  209. package/test/unit/models/transfer/transferFulfilment.test.js +14 -5
  210. package/test/unit/models/transfer/transferFulfilmentDuplicateCheck.test.js +4 -0
  211. package/test/unit/models/transfer/transferParticipant.test.js +14 -5
  212. package/test/unit/models/transfer/transferStateChange.test.js +3 -0
  213. package/test/unit/models/transfer/transferTimeout.test.js +6 -0
  214. package/test/unit/seeds/amountType.test.js +6 -22
  215. package/test/unit/seeds/balanceOfPayments.test.js +6 -22
  216. package/test/unit/seeds/bulkProcessingState.test.js +84 -0
  217. package/test/unit/{lib/sidecar/nullClient.test.js → seeds/bulkTransferState.test.js} +36 -39
  218. package/test/unit/seeds/currency.test.js +6 -22
  219. package/test/unit/seeds/endpointType.test.js +6 -22
  220. package/test/unit/seeds/ledgerAccountType.test.js +5 -22
  221. package/test/unit/seeds/ledgerEntryType.test.js +6 -22
  222. package/test/unit/seeds/participant.test.js +5 -22
  223. package/test/unit/seeds/participantLimitType.test.js +6 -22
  224. package/test/unit/seeds/partyIdentifierType.test.js +6 -22
  225. package/test/unit/seeds/partyType.test.js +6 -22
  226. package/test/unit/seeds/settlementState.test.js +5 -22
  227. package/test/unit/seeds/settlementWindow1State.test.js +5 -22
  228. package/test/unit/seeds/transactionInitiator.test.js +6 -22
  229. package/test/unit/seeds/transactionInitiatorType.test.js +6 -22
  230. package/test/unit/seeds/transactionScenario.test.js +6 -22
  231. package/test/unit/seeds/transferParticipantRoleType.test.js +6 -22
  232. package/test/unit/seeds/transferState.test.js +6 -22
  233. package/test/unit/shared/plugins.test.js +31 -1
  234. package/test/unit/shared/setup.test.js +25 -36
  235. package/test/util/helpers.js +37 -2
  236. package/test/util/randomTransfers.js +1 -1
  237. package/test/util/scripts/env.sh +6 -5
  238. package/test/util/scripts/populateTestData.sh +204 -181
  239. package/test/util/scripts/populateTestDataForLegacySimulator.sh +261 -0
  240. package/test/util/scripts/restartObjStore.sh +1 -1
  241. package/test-integration.Dockerfile +15 -15
  242. package/test.Dockerfile +12 -12
  243. package/.circleci/_set_up_deploy_envs.sh +0 -47
  244. package/.dockerignore +0 -17
  245. package/.ncurc.json +0 -3
  246. package/server.sh +0 -4
  247. package/sonar-project.properties +0 -17
  248. package/src/lib/sidecar/index.js +0 -47
  249. package/src/lib/sidecar/nullClient.js +0 -18
  250. package/test/.env +0 -8
  251. package/test/integration-config.json +0 -367
  252. package/test/integration-runner.env +0 -31
  253. package/test/integration-runner.sh +0 -264
  254. package/test/spec-runner.sh +0 -132
  255. package/test/unit/lib/sidecar/index.test.js +0 -148
  256. package/test/unit/models/position/participantLimit.test.js +0 -135
@@ -55,165 +55,165 @@ Test('transfer validator', validatorTest => {
55
55
  test.end()
56
56
  })
57
57
 
58
- validatorTest.test('validateByName should', validateByNameTest => {
59
- validateByNameTest.test('pass validation for valid payload', async (test) => {
58
+ validatorTest.test('validatePrepare should', validatePrepareTest => {
59
+ validatePrepareTest.test('pass validation for valid payload', async (test) => {
60
60
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
61
61
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
62
62
  CryptoConditions.validateCondition.returns(true)
63
63
 
64
- const { validationPassed } = await Validator.validateByName(payload, headers)
64
+ const { validationPassed } = await Validator.validatePrepare(payload, headers)
65
65
  test.equal(validationPassed, true)
66
66
  test.end()
67
67
  })
68
68
 
69
- validateByNameTest.test('fail validation for no payload', async (test) => {
70
- const { validationPassed, reasons } = await Validator.validateByName(null)
69
+ validatePrepareTest.test('fail validation for no payload', async (test) => {
70
+ const { validationPassed, reasons } = await Validator.validatePrepare(null)
71
71
  test.equal(validationPassed, false)
72
72
  test.deepEqual(reasons, ['Transfer must be provided'])
73
73
  test.end()
74
74
  })
75
75
 
76
- validateByNameTest.test('fail validation when FSPIOP-Source doesnt match Payer', async (test) => {
76
+ validatePrepareTest.test('fail validation when FSPIOP-Source doesnt match Payer', async (test) => {
77
77
  const headersModified = { 'fspiop-source': 'dfsp2' }
78
- const { validationPassed, reasons } = await Validator.validateByName(payload, headersModified)
78
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headersModified)
79
79
  test.equal(validationPassed, false)
80
80
  test.deepEqual(reasons, ['FSPIOP-Source header should match Payer'])
81
81
  test.end()
82
82
  })
83
83
 
84
- validateByNameTest.test('fail validation for invalid condition', async (test) => {
84
+ validatePrepareTest.test('fail validation for invalid condition', async (test) => {
85
85
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
86
86
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
87
87
  CryptoConditions.validateCondition.throws(new Error())
88
88
 
89
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
89
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
90
90
  test.equal(validationPassed, false)
91
91
  test.deepEqual(reasons, ['Condition validation failed'])
92
92
  test.end()
93
93
  })
94
94
 
95
- validateByNameTest.test('fail validation for no condition', async (test) => {
95
+ validatePrepareTest.test('fail validation for no condition', async (test) => {
96
96
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
97
97
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
98
98
  payload.condition = null
99
99
 
100
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
100
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
101
101
  test.equal(validationPassed, false)
102
102
  test.deepEqual(reasons, ['Condition is required for a conditional transfer'])
103
103
  test.end()
104
104
  })
105
105
 
106
- validateByNameTest.test('Fail validation for invalid expiration date', async (test) => {
106
+ validatePrepareTest.test('Fail validation for invalid expiration date', async (test) => {
107
107
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
108
108
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
109
109
  CryptoConditions.validateCondition.returns(true)
110
110
  payload.expiration = '1971-11-24T08:38:08.699-04:00'
111
111
 
112
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
112
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
113
113
  test.equal(validationPassed, false)
114
114
  test.deepEqual(reasons, ['Expiration date 1971-11-24T12:38:08.699Z is already in the past'])
115
115
  test.end()
116
116
  })
117
117
 
118
- validateByNameTest.test('fail validation for no expiration date', async (test) => {
118
+ validatePrepareTest.test('fail validation for no expiration date', async (test) => {
119
119
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
120
120
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
121
121
  CryptoConditions.validateCondition.returns(true)
122
122
  payload.expiration = null
123
123
 
124
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
124
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
125
125
  test.equal(validationPassed, false)
126
126
  test.deepEqual(reasons, ['Expiration is required for conditional transfer'])
127
127
  test.end()
128
128
  })
129
129
 
130
- validateByNameTest.test('fail validation for invalid participant', async (test) => {
130
+ validatePrepareTest.test('fail validation for invalid participant', async (test) => {
131
131
  Participant.getByName.withArgs('dfsp1').returns(Promise.resolve({ isActive: true }))
132
132
  Participant.getByName.withArgs('dfsp2').returns(Promise.resolve(null))
133
133
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
134
134
  CryptoConditions.validateCondition.returns(true)
135
135
 
136
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
136
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
137
137
  test.equal(validationPassed, false)
138
138
  test.deepEqual(reasons, ['Participant dfsp2 not found'])
139
139
  test.end()
140
140
  })
141
141
 
142
- validateByNameTest.test('fail validation for inactive participant', async (test) => {
142
+ validatePrepareTest.test('fail validation for inactive participant', async (test) => {
143
143
  Participant.getByName.withArgs('dfsp1').returns(Promise.resolve({ isActive: true }))
144
144
  Participant.getByName.withArgs('dfsp2').returns(Promise.resolve({ isActive: false }))
145
145
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
146
146
  CryptoConditions.validateCondition.returns(true)
147
147
 
148
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
148
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
149
149
  test.equal(validationPassed, false)
150
150
  test.deepEqual(reasons, ['Participant dfsp2 is inactive'])
151
151
  test.end()
152
152
  })
153
153
 
154
- validateByNameTest.test('fail validation for invalid account', async (test) => {
154
+ validatePrepareTest.test('fail validation for invalid account', async (test) => {
155
155
  Participant.getByName.withArgs('dfsp1').returns(Promise.resolve({ isActive: true }))
156
156
  Participant.getByName.withArgs('dfsp2').returns(Promise.resolve({ isActive: true }))
157
157
  Participant.getAccountByNameAndCurrency.withArgs('dfsp1', 'USD', Enum.Accounts.LedgerAccountType.POSITION).returns(Promise.resolve({ currencyIsActive: true }))
158
158
  Participant.getAccountByNameAndCurrency.withArgs('dfsp2', 'USD', Enum.Accounts.LedgerAccountType.POSITION).returns(Promise.resolve(null))
159
159
  CryptoConditions.validateCondition.returns(true)
160
160
 
161
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
161
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
162
162
  test.equal(validationPassed, false)
163
163
  test.deepEqual(reasons, ['Participant dfsp2 USD account not found'])
164
164
  test.end()
165
165
  })
166
166
 
167
- validateByNameTest.test('fail validation for inactive account', async (test) => {
167
+ validatePrepareTest.test('fail validation for inactive account', async (test) => {
168
168
  Participant.getByName.withArgs('dfsp1').returns(Promise.resolve({ isActive: true }))
169
169
  Participant.getByName.withArgs('dfsp2').returns(Promise.resolve({ isActive: true }))
170
170
  Participant.getAccountByNameAndCurrency.withArgs('dfsp1', 'USD', Enum.Accounts.LedgerAccountType.POSITION).returns(Promise.resolve({ currencyIsActive: true }))
171
171
  Participant.getAccountByNameAndCurrency.withArgs('dfsp2', 'USD', Enum.Accounts.LedgerAccountType.POSITION).returns(Promise.resolve({ currencyIsActive: false }))
172
172
  CryptoConditions.validateCondition.returns(true)
173
173
 
174
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
174
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
175
175
  test.equal(validationPassed, false)
176
176
  test.deepEqual(reasons, ['Participant dfsp2 USD account is inactive'])
177
177
  test.end()
178
178
  })
179
179
 
180
- validateByNameTest.test('pass validation for valid payload', async (test) => {
180
+ validatePrepareTest.test('pass validation for valid payload', async (test) => {
181
181
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
182
182
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
183
183
  CryptoConditions.validateCondition.returns(true)
184
184
  payload.amount.amount = '123.12345'
185
185
 
186
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
186
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
187
187
  test.equal(validationPassed, false)
188
188
  test.deepEqual(reasons, ['Amount 123.12345 exceeds allowed scale of 4'])
189
189
  test.end()
190
190
  })
191
191
 
192
- validateByNameTest.test('fail validation for same payer and payee', async (test) => {
192
+ validatePrepareTest.test('fail validation for same payer and payee', async (test) => {
193
193
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
194
194
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
195
195
  CryptoConditions.validateCondition.returns(true)
196
196
  payload.payeeFsp = payload.payerFsp
197
197
 
198
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
198
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
199
199
  test.equal(validationPassed, false)
200
- test.deepEqual(reasons, ['Payer and Payee should be different'])
200
+ test.deepEqual(reasons, ['Payer FSP and Payee FSP should be different, unless on-us tranfers are allowed by the Scheme'])
201
201
  test.end()
202
202
  })
203
203
 
204
- validateByNameTest.test('pass validation for valid payload', async (test) => {
204
+ validatePrepareTest.test('pass validation for valid payload', async (test) => {
205
205
  Participant.getByName.returns(Promise.resolve({ isActive: true }))
206
206
  Participant.getAccountByNameAndCurrency.returns(Promise.resolve({ currencyIsActive: true }))
207
207
  CryptoConditions.validateCondition.returns(true)
208
208
  payload.amount.amount = '123456789012345.6789'
209
209
 
210
- const { validationPassed, reasons } = await Validator.validateByName(payload, headers)
210
+ const { validationPassed, reasons } = await Validator.validatePrepare(payload, headers)
211
211
  test.equal(validationPassed, false)
212
212
  test.deepEqual(reasons, ['Amount 123456789012345.6789 exceeds allowed precision of 18'])
213
213
  test.end()
214
214
  })
215
215
 
216
- validateByNameTest.end()
216
+ validatePrepareTest.end()
217
217
  })
218
218
 
219
219
  validatorTest.test('validateById should', validateByIdTest => {
@@ -8,21 +8,11 @@ const Enums = require('../../../src/lib/enum')
8
8
 
9
9
  Test('Cache test', async (cacheTest) => {
10
10
  let sandbox
11
- let allEnumsValue
12
-
13
- const templateValueForEnum = (enumId) => {
14
- return { testEnumKey: `testEnum of ${enumId}` }
15
- }
16
11
 
17
12
  cacheTest.beforeEach(t => {
18
13
  sandbox = Sinon.createSandbox()
19
14
  sandbox.stub(Enums)
20
15
  sandbox.stub(Config.CACHE_CONFIG, 'CACHE_ENABLED')
21
- allEnumsValue = {}
22
- for (const enumId of Enums.enumsIds) {
23
- Enums[enumId].returns(Promise.resolve(templateValueForEnum(enumId)))
24
- allEnumsValue[enumId] = templateValueForEnum(enumId)
25
- }
26
16
  Cache.registerCacheClient({
27
17
  id: 'testCacheClient',
28
18
  preloadCache: async () => sandbox.stub()
@@ -60,60 +50,6 @@ Test('Cache test', async (cacheTest) => {
60
50
  initTest.end()
61
51
  })
62
52
 
63
- await cacheTest.test('Caching enums:', async (enumTest) => {
64
- await enumTest.test('should pre-fetch all enums info at start', async (test) => {
65
- // Check that Enums haven't been called
66
- for (const enumId of Enums.enumsIds) {
67
- test.notOk(Enums[enumId].calledOnce, `enum ${enumId} wasn't called before initCache`)
68
- }
69
-
70
- // This should pre-fetch all enums
71
- await Cache.initCache()
72
-
73
- // Check that Enums have been called
74
- for (const enumId of Enums.enumsIds) {
75
- test.ok(Enums[enumId].calledOnce, `enum ${enumId} was called once during initCache`)
76
- }
77
- await Cache.destroyCache()
78
- test.end()
79
- })
80
-
81
- await enumTest.test('should call enums only once and then should return cached data (should not call enums again)', async (test) => {
82
- // This should pre-fetch all enums
83
- await Cache.initCache()
84
-
85
- // Check that Enums have been called once
86
- for (const enumId of Enums.enumsIds) {
87
- test.ok(Enums[enumId].calledOnce, `enum ${enumId} was called once`)
88
- }
89
-
90
- // Get Enum info from cache and verify values
91
- for (const enumId of Enums.enumsIds) {
92
- const returnedValue = await Cache.getEnums(enumId)
93
- test.deepEqual(templateValueForEnum(enumId), returnedValue, `value for enum ${enumId} is correct`)
94
- }
95
-
96
- // Check again that Enums have been called once (so cache worked)
97
- for (const enumId of Enums.enumsIds) {
98
- test.ok(Enums[enumId].calledOnce, `enum ${enumId} was still called just once`)
99
- }
100
-
101
- // Let's check the "all" summary-enum also works well on cached values
102
- const returnedAllEnumsValue = await Cache.getEnums('all')
103
- test.deepEqual(returnedAllEnumsValue, allEnumsValue, 'the "all" enum type works well')
104
-
105
- // Check again that Enums have been called once (so cache worked)
106
- for (const enumId of Enums.enumsIds) {
107
- test.ok(Enums[enumId].calledOnce, `enum ${enumId} was still called just once`)
108
- }
109
-
110
- await Cache.destroyCache()
111
- test.end()
112
- })
113
-
114
- enumTest.end()
115
- })
116
-
117
53
  await cacheTest.test('Cache client', async (cacheClientTest) => {
118
54
  await cacheClientTest.test('preload should be called once during Cache.initCache()', async (test) => {
119
55
  let preloadCacheCalledCnt = 0
@@ -0,0 +1,121 @@
1
+ /*****
2
+ Test that integrated enumsCached.js and cache.js work together as expected.
3
+
4
+ License
5
+ --------------
6
+ Copyright © 2017 Bill & Melinda Gates Foundation
7
+ The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+ Contributors
11
+ --------------
12
+ This is the official list of the Mojaloop project contributors for this file.
13
+ Names of the original copyright holders (individuals or organizations)
14
+ should be listed with a '*' in the first column. People who have
15
+ contributed from an organization can be listed under the organization
16
+ that actually holds the copyright for their contributions (see the
17
+ Gates Foundation organization for an example). Those individuals should have
18
+ their names indented and be marked with a '-'. Email address can be added
19
+ optionally within square brackets <email>.
20
+ * Gates Foundation
21
+ - Name Surname <name.surname@gatesfoundation.com>
22
+
23
+ * Roman Pietrzak <roman.pietrzak@modusbox.com>
24
+ --------------
25
+ ******/
26
+
27
+ 'use strict'
28
+
29
+ const Test = require('tapes')(require('tape'))
30
+ const Sinon = require('sinon')
31
+ const EnumUncached = require('../../../src/lib/enum')
32
+ const Config = require('../../../src/lib/config')
33
+ const Cache = require('../../../src/lib/cache')
34
+ const Model = require('../../../src/lib/enumCached')
35
+
36
+ Test('Enums with caching', async (enumCachedTest) => {
37
+ let sandbox
38
+ let allEnumsValue
39
+
40
+ const templateValueForEnum = (enumId) => {
41
+ return { testEnumKey: `testEnum of ${enumId}` }
42
+ }
43
+
44
+ enumCachedTest.beforeEach(t => {
45
+ sandbox = Sinon.createSandbox()
46
+ sandbox.stub(EnumUncached)
47
+ sandbox.stub(Config.CACHE_CONFIG, 'CACHE_ENABLED')
48
+ Config.CACHE_CONFIG.CACHE_ENABLED = true
49
+ allEnumsValue = {}
50
+ for (const enumId of EnumUncached.enumsIds) {
51
+ EnumUncached[enumId].returns(Promise.resolve(templateValueForEnum(enumId)))
52
+ allEnumsValue[enumId] = templateValueForEnum(enumId)
53
+ }
54
+ t.end()
55
+ })
56
+
57
+ enumCachedTest.afterEach(t => {
58
+ sandbox.restore()
59
+ t.end()
60
+ })
61
+
62
+ await enumCachedTest.test('Cache should pre-fetch all enums info at start', async (test) => {
63
+ // Check that Enums haven't been called
64
+ for (const enumId of EnumUncached.enumsIds) {
65
+ test.notOk(EnumUncached[enumId].calledOnce, `enum ${enumId} wasn't called before initCache`)
66
+ }
67
+
68
+ // This should pre-fetch all enums
69
+ await Model.initialize()
70
+ await Cache.initCache()
71
+
72
+ // Check that Enums have been called
73
+ for (const enumId of EnumUncached.enumsIds) {
74
+ test.ok(EnumUncached[enumId].calledOnce, `enum ${enumId} was called once during initCache`)
75
+ }
76
+ await Cache.destroyCache()
77
+ await Cache.dropClients()
78
+ test.end()
79
+ })
80
+
81
+ await enumCachedTest.test('should call enums only once and then should return cached data (should not call enums again)', async (test) => {
82
+ // Check that Enums haven't been called
83
+ for (const enumId of EnumUncached.enumsIds) {
84
+ test.notOk(EnumUncached[enumId].calledOnce, `enum ${enumId} wasn't called before initCache`)
85
+ }
86
+
87
+ // This should pre-fetch all enums
88
+ await Model.initialize()
89
+ await Cache.initCache()
90
+
91
+ // Check that Enums have been called once
92
+ for (const enumId of EnumUncached.enumsIds) {
93
+ test.ok(EnumUncached[enumId].calledOnce, `enum ${enumId} was called once`)
94
+ }
95
+
96
+ // Get Enum info from cache and verify values
97
+ for (const enumId of EnumUncached.enumsIds) {
98
+ const returnedValue = await Model.getEnums(enumId)
99
+ test.deepEqual(templateValueForEnum(enumId), returnedValue, `value for enum ${enumId} is correct`)
100
+ }
101
+
102
+ // Check again that Enums have been called once (so cache worked)
103
+ for (const enumId of EnumUncached.enumsIds) {
104
+ test.ok(EnumUncached[enumId].calledOnce, `enum ${enumId} was still called just once`)
105
+ }
106
+
107
+ // Let's check the "all" summary-enum also works well on cached values
108
+ const returnedAllEnumsValue = await Model.getEnums('all')
109
+ test.deepEqual(returnedAllEnumsValue, allEnumsValue, 'the "all" enum type works well')
110
+
111
+ // Check again that Enums have been called once (so cache worked)
112
+ for (const enumId of EnumUncached.enumsIds) {
113
+ test.ok(EnumUncached[enumId].calledOnce, `enum ${enumId} was still called just once`)
114
+ }
115
+ await Cache.destroyCache()
116
+ await Cache.dropClients()
117
+ test.end()
118
+ })
119
+
120
+ await enumCachedTest.end()
121
+ })
@@ -0,0 +1,34 @@
1
+ 'use strict'
2
+
3
+ const Test = require('tape')
4
+ const Proxyquire = require('proxyquire')
5
+ const Defaults = require('../../../config/default.json')
6
+
7
+ Test('Config should', configTest => {
8
+ configTest.test('enable API_DOC_ENDPOINTS_ENABLED', async function (test) {
9
+ const DefaultsStub = { ...Defaults }
10
+ DefaultsStub.API_DOC_ENDPOINTS_ENABLED = true
11
+
12
+ const Config = Proxyquire('../../../src/lib/config', {
13
+ '../../config/default.json': DefaultsStub
14
+ })
15
+
16
+ test.ok(Config.API_DOC_ENDPOINTS_ENABLED === true)
17
+ test.end()
18
+ })
19
+
20
+ configTest.test('disable API_DOC_ENDPOINTS_ENABLED', async function (test) {
21
+ console.log(Defaults)
22
+ const DefaultsStub = { ...Defaults }
23
+ DefaultsStub.API_DOC_ENDPOINTS_ENABLED = false
24
+
25
+ const Config = Proxyquire('../../../src/lib/config', {
26
+ '../../config/default.json': DefaultsStub
27
+ })
28
+
29
+ test.ok(Config.API_DOC_ENDPOINTS_ENABLED === false)
30
+ test.end()
31
+ })
32
+
33
+ configTest.end()
34
+ })
@@ -163,6 +163,7 @@ Test('Enum test', async (enumTest) => {
163
163
 
164
164
  enumTest.beforeEach(t => {
165
165
  sandbox = Sinon.createSandbox()
166
+
166
167
  Db.endpointType = {
167
168
  find: sandbox.stub()
168
169
  }
@@ -191,6 +192,10 @@ Test('Enum test', async (enumTest) => {
191
192
  find: sandbox.stub()
192
193
  }
193
194
 
195
+ Db.from = (table) => {
196
+ return Db[table]
197
+ }
198
+
194
199
  t.end()
195
200
  })
196
201
 
@@ -202,7 +207,7 @@ Test('Enum test', async (enumTest) => {
202
207
  await enumTest.test('endpointType should', async (endpointTypeTest) => {
203
208
  await endpointTypeTest.test('return the endpoints', async (test) => {
204
209
  try {
205
- Db.endpointType.find.returns(Promise.resolve(allEnums.endpointType))
210
+ Db.from('endpointType').find.returns(Promise.resolve(allEnums.endpointType))
206
211
  const result = await Model.endpointType()
207
212
  test.deepEqual(result, allEnumExpected.endpointType, 'Results match')
208
213
  test.end()
@@ -0,0 +1,82 @@
1
+ /*****
2
+ License
3
+ --------------
4
+ Copyright © 2017 Bill & Melinda Gates Foundation
5
+ The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
8
+ Contributors
9
+ --------------
10
+ This is the official list of the Mojaloop project contributors for this file.
11
+ Names of the original copyright holders (individuals or organizations)
12
+ should be listed with a '*' in the first column. People who have
13
+ contributed from an organization can be listed under the organization
14
+ that actually holds the copyright for their contributions (see the
15
+ Gates Foundation organization for an example). Those individuals should have
16
+ their names indented and be marked with a '-'. Email address can be added
17
+ optionally within square brackets <email>.
18
+ * Gates Foundation
19
+ - Name Surname <name.surname@gatesfoundation.com>
20
+
21
+ * Roman Pietrzak <roman.pietrzak@modusbox.com>
22
+ --------------
23
+ ******/
24
+
25
+ 'use strict'
26
+
27
+ const Test = require('tapes')(require('tape'))
28
+ const Sinon = require('sinon')
29
+ const EnumUncached = require('../../../src/lib/enum')
30
+ const Cache = require('../../../src/lib/cache')
31
+ const Model = require('../../../src/lib/enumCached')
32
+
33
+ Test('Enums cached model', async (enumCachedTest) => {
34
+ let sandbox
35
+
36
+ enumCachedTest.beforeEach(t => {
37
+ sandbox = Sinon.createSandbox()
38
+ sandbox.stub(Cache)
39
+ sandbox.stub(EnumUncached)
40
+ t.end()
41
+ })
42
+
43
+ enumCachedTest.afterEach(t => {
44
+ sandbox.restore()
45
+ t.end()
46
+ })
47
+
48
+ await enumCachedTest.test('initializes cache correctly', async (test) => {
49
+ const cacheClient = {
50
+ createKey: sandbox.stub().returns({})
51
+ }
52
+ Cache.registerCacheClient.returns(cacheClient)
53
+
54
+ // initialize calls registerCacheClient and createKey
55
+ test.notOk(Cache.registerCacheClient.calledOnce)
56
+ test.notOk(cacheClient.createKey.calledOnce)
57
+ await Model.initialize()
58
+ test.ok(Cache.registerCacheClient.calledOnce)
59
+ test.ok(cacheClient.createKey.calledOnce)
60
+
61
+ test.end()
62
+ })
63
+
64
+ await enumCachedTest.test('calls drop() for invalidateEnumCache', async (test) => {
65
+ // initialize
66
+ const cacheClient = {
67
+ createKey: sandbox.stub().returns({}),
68
+ drop: sandbox.stub()
69
+ }
70
+ Cache.registerCacheClient.returns(cacheClient)
71
+ await Model.initialize()
72
+
73
+ // check
74
+ test.notOk(cacheClient.drop.calledOnce)
75
+ await Model.invalidateEnumCache()
76
+ test.ok(cacheClient.drop.calledOnce)
77
+
78
+ test.end()
79
+ })
80
+
81
+ await enumCachedTest.end()
82
+ })
@@ -36,6 +36,7 @@ const { statusEnum, serviceName } = require('@mojaloop/central-services-shared')
36
36
 
37
37
  const MigrationLockModel = require('../../../../src/models/misc/migrationLock')
38
38
  const Consumer = require('@mojaloop/central-services-stream').Util.Consumer
39
+ const Logger = require('@mojaloop/central-services-logger')
39
40
 
40
41
  const {
41
42
  getSubServiceHealthBroker,
@@ -49,6 +50,7 @@ Test('SubServiceHealth test', subServiceHealthTest => {
49
50
  sandbox = Sinon.createSandbox()
50
51
  sandbox.stub(Consumer, 'getListOfTopics')
51
52
  sandbox.stub(Consumer, 'isConnected')
53
+ sandbox.stub(Logger, 'isDebugEnabled').value(true)
52
54
 
53
55
  t.end()
54
56
  })
@@ -39,6 +39,8 @@ Test('logger', loggerTest => {
39
39
  sandbox = Sinon.createSandbox()
40
40
  sandbox.stub(Logger, 'info')
41
41
  sandbox.stub(Logger, 'debug')
42
+ sandbox.stub(Logger, 'isInfoEnabled').value(true)
43
+ sandbox.stub(Logger, 'isDebugEnabled').value(true)
42
44
  sandbox.stub(Util, 'inspect')
43
45
 
44
46
  test.end()
@@ -54,18 +56,18 @@ Test('logger', loggerTest => {
54
56
  const request = {
55
57
  headers: { traceid: '123456' },
56
58
  method: 'post',
57
- url: { path: '/participants' },
59
+ path: '/participants',
58
60
  query: { token: '1234' },
59
- body: 'this is the body'
61
+ payload: 'this is the body'
60
62
  }
61
63
  RequestLogger.logRequest(request)
62
64
  test.ok(Logger.debug.calledThrice)
63
65
  const args = Logger.debug.firstCall.args
64
66
  const args2 = Logger.debug.secondCall.args
65
67
  const args3 = Logger.debug.thirdCall.args
66
- test.equal(args[0], `L1p-Trace-Id=${request.headers.traceid} - Method: ${request.method} Path: ${request.url.path} Query: ${JSON.stringify(request.query)}`)
67
- test.equal(args2[0], `L1p-Trace-Id=${request.headers.traceid} - Headers: ${JSON.stringify(request.headers)}`)
68
- test.equal(args3[0], `L1p-Trace-Id=${request.headers.traceid} - Body: ${request.body}`)
68
+ test.equal(args[0], `L1p-Trace-Id=${request.headers.traceid} - Method: ${request.method}, Path: ${request.path}, Query: ${JSON.stringify(request.query)}`)
69
+ test.equal(args2[0], `L1p-Trace-Id=${request.headers.traceid} - Headers: ${JSON.stringify(request.headers, null, 2)}`)
70
+ test.equal(args3[0], `L1p-Trace-Id=${request.headers.traceid} - Body: ${JSON.stringify(request.payload, null, 2)}`)
69
71
  test.end()
70
72
  })
71
73
 
@@ -73,7 +75,7 @@ Test('logger', loggerTest => {
73
75
  const request = {
74
76
  headers: { traceid: '123456' },
75
77
  method: 'post',
76
- url: { path: '/participants' },
78
+ path: '/participants',
77
79
  query: { token: '1234' }
78
80
  }
79
81
  RequestLogger.logRequest(request)
@@ -88,11 +90,11 @@ Test('logger', loggerTest => {
88
90
  responseTest.test('send info message to the serviceslogger', test => {
89
91
  const request = {
90
92
  headers: { traceid: '123456' },
91
- response: { source: 'this is the response', statusCode: '200' }
93
+ response: { message: 'this is the response', statusCode: '200', stack: 'test' }
92
94
  }
93
95
  RequestLogger.logResponse(request)
94
96
  const args = Logger.debug.firstCall.args
95
- test.equal(args[0], `L1p-Trace-Id=${request.headers.traceid} - Response: ${JSON.stringify(request.response.source)} Status: ${request.response.statusCode}`)
97
+ test.equal(args[0], `L1p-Trace-Id=${request.headers.traceid} - Response: ${JSON.stringify(request.response, null, 2)}, Status: ${request.response.statusCode}, Stack: ${request.response.stack}`)
96
98
  test.end()
97
99
  })
98
100
 
@@ -108,12 +110,12 @@ Test('logger', loggerTest => {
108
110
  responseTest.test('use util.inspect if JSON.stringify throws', test => {
109
111
  const request = {
110
112
  headers: { traceid: '123456' },
111
- response: { source: { body: 'this is the response' }, statusCode: '200' }
113
+ response: { body: 'this is the response', statusCode: '200' }
112
114
  }
113
- request.response.source.circular = request.response
115
+ request.response.circular = request.response
114
116
  RequestLogger.logResponse(request)
115
117
  const args = Util.inspect.firstCall.args
116
- test.equal(args[0], request.response.source)
118
+ test.equal(args[0], request.response)
117
119
  test.end()
118
120
  })
119
121
  responseTest.end()
@@ -122,7 +124,7 @@ Test('logger', loggerTest => {
122
124
  loggerTest.test('websocket should', requestTest => {
123
125
  requestTest.test('send info message to the serviceslogger', test => {
124
126
  const request = {
125
- body: 'this is the body'
127
+ payload: 'this is the body'
126
128
  }
127
129
  RequestLogger.logWebsocket(request)
128
130
  const args = Logger.info.firstCall.args