Skip to content

Commit

Permalink
test(mojaloop/#3053): add test to assert subScenario mapping from out…
Browse files Browse the repository at this point in the history
…bound to quote request (#106)

* test(mojaloop/#3053): add test to assert subScenario mapping from outbound to quote request

* chore: update local tests

* Update sdk.json

* chore: rename folder and file
  • Loading branch information
kleyow authored Jan 10, 2023
1 parent 2d19a33 commit 7dc6fe8
Showing 1 changed file with 336 additions and 0 deletions.
336 changes: 336 additions & 0 deletions collections/hub/other_tests/sdk_tests/subscenario.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
{
"options": {},
"name": "multi",
"test_cases": [
{
"id": 1,
"name": "MAS1 - Outbound SDK post /transfers supports subScenario field and is forwarded to payee DFSP in FSPIOP post /quotes request.",
"fileInfo": {
"path": "testing-toolkit-test-cases/collections/hub/other_tests/sdk_tests/subscenario.json"
},
"meta": {
"info": "MAS1 - Outbound SDK post /transfers supports subScenario field and is forwarded to payee DFSP in FSPIOP post /quotes request."
},
"requests": [
{
"id": 1,
"description": "POST /transfers",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"asynchronous": true,
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/transfers",
"path": "/transfers",
"method": "post",
"body": {
"from": {
"displayName": "{$inputs.TTKSIM2_MSISDN_1_FIRST_NAME}",
"idType": "MSISDN",
"idValue": "{$inputs.TTKSIM1_MSISDN_1}"
},
"to": {
"idType": "MSISDN",
"idValue": "{$inputs.TTKSIM2_MSISDN_1}"
},
"amountType": "SEND",
"currency": "{$inputs.TTKSIM1_CURRENCY}",
"amount": "10",
"transactionType": "TRANSFER",
"subScenario": "SUBSCENARIO",
"initiatorType": "CONSUMER",
"note": "test payment",
"homeTransactionId": "123ABC"
},
"scriptingEngine": "javascript",
"tests": {
"assertions": [
{
"id": 1,
"description": "subScenario present in response",
"exec": [
"expect(response.body.subScenario).to.equal('SUBSCENARIO')"
]
}
]
},
"scripts": {
"postRequest": {
"exec": [
"environment.transferId = response.body.transferId;",
""
]
}
}
},
{
"id": 2,
"description": "PUT /transfers - accept party",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"asynchronous": true,
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/transfers/{transferId}",
"path": "/transfers/{$environment.transferId}",
"method": "put",
"params": {
"transferId": "{$environment.transferId}"
},
"body": {
"acceptParty": true
},
"scriptingEngine": "javascript",
"url": null,
"queryParams": {},
"tests": {
"assertions": [
{
"id": 1,
"description": "subScenario present in quote request",
"exec": [
"expect(environment.quoteRequest.transactionType.subScenario).to.equal('SUBSCENARIO')"
]
}
]
},
"scripts": {
"preRequest": {
"exec": [
""
]
},
"postRequest": {
"exec": [
"environment.quoteRequest = JSON.parse(response.body.quoteRequest.body);",
"console.log(environment.quoteRequest)"
]
}
}
},
{
"id": 3,
"description": "PUT /transfers - accept quote",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"asynchronous": true,
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/transfers/{transferId}",
"path": "/transfers/{$environment.transferId}",
"method": "put",
"params": {
"transferId": "{$environment.transferId}"
},
"body": {
"acceptQuote": true
},
"scriptingEngine": "javascript",
"url": null,
"queryParams": {},
"scripts": {
"preRequest": {
"exec": [
""
]
}
}
}
]
},
{
"id": 2,
"name": "MAS2 - Outbound SDK post /transfers supports absent subScenario field.",
"fileInfo": {
"path": "testing-toolkit-test-cases/collections/hub/other_tests/sdk_tests/subscenario.json"
},
"meta": {
"info": "MAS2 - Outbound SDK post /transfers supports subScenario field and is forwarded to payee DFSP in FSPIOP post /quotes request."
},
"requests": [
{
"id": 1,
"description": "POST /transfers",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"asynchronous": true,
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/transfers",
"path": "/transfers",
"method": "post",
"body": {
"from": {
"displayName": "{$inputs.TTKSIM2_MSISDN_1_FIRST_NAME}",
"idType": "MSISDN",
"idValue": "{$inputs.TTKSIM1_MSISDN_1}"
},
"to": {
"idType": "MSISDN",
"idValue": "{$inputs.TTKSIM2_MSISDN_1}"
},
"amountType": "SEND",
"currency": "{$inputs.TTKSIM1_CURRENCY}",
"amount": "10",
"transactionType": "TRANSFER",
"initiatorType": "CONSUMER",
"note": "test payment",
"homeTransactionId": "123ABC"
},
"scriptingEngine": "javascript",
"tests": {
"assertions": [
{
"id": 1,
"description": "statusCode is 200",
"exec": [
"expect(response.status).to.equal(200)"
]
}
]
},
"scripts": {
"postRequest": {
"exec": [
"environment.transferId = response.body.transferId;",
""
]
}
}
},
{
"id": 2,
"description": "PUT /transfers - accept party",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"asynchronous": true,
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/transfers/{transferId}",
"path": "/transfers/{$environment.transferId}",
"method": "put",
"params": {
"transferId": "{$environment.transferId}"
},
"body": {
"acceptParty": true
},
"scriptingEngine": "javascript",
"url": null,
"queryParams": {},
"tests": {
"assertions": [
{
"id": 1,
"description": "statusCode is 200",
"exec": [
"expect(response.status).to.equal(200)"
]
}
]
},
"scripts": {
"preRequest": {
"exec": [
""
]
},
"postRequest": {
"exec": [
"environment.quoteRequest = JSON.parse(response.body.quoteRequest.body);",
"console.log(environment.quoteRequest)"
]
}
}
},
{
"id": 3,
"description": "PUT /transfers - accept quote",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"asynchronous": true,
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/transfers/{transferId}",
"path": "/transfers/{$environment.transferId}",
"method": "put",
"params": {
"transferId": "{$environment.transferId}"
},
"body": {
"acceptQuote": true
},
"scriptingEngine": "javascript",
"url": null,
"queryParams": {},
"tests": {
"assertions": [
{
"id": 1,
"description": "statusCode is 200",
"exec": [
"expect(response.status).to.equal(200)"
]
}
]
},
"scripts": {
"preRequest": {
"exec": [
""
]
}
}
}
]
}
]
}

0 comments on commit 7dc6fe8

Please sign in to comment.