From d02a3865376129934c43818bd9c107ee5f8163d6 Mon Sep 17 00:00:00 2001 From: John Shields Date: Fri, 8 Mar 2024 12:06:29 +0000 Subject: [PATCH] PP-11681 Refactor MockClient url test condition. --- app/services/clients/ledger.client.test.js | 34 +++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/app/services/clients/ledger.client.test.js b/app/services/clients/ledger.client.test.js index 97fa602860..25884451b0 100644 --- a/app/services/clients/ledger.client.test.js +++ b/app/services/clients/ledger.client.test.js @@ -61,30 +61,16 @@ class MockClient { async get (url, description) { let dataResponse - if (url.match(/\.*\/event/)) { - dataResponse = ledgerTransactionEventsFixture - return Promise.resolve({ data: dataResponse }) - } - if (url.match(/\/transaction\//)) { - dataResponse = validCreatedTransactionDetailsResponse - return Promise.resolve({ data: dataResponse }) - } - if (url.match(/\/report\/transactions-summary/)) { - dataResponse = validTransactionSummaryResponse - return Promise.resolve({ data: dataResponse }) - } - if (url.match(/\/agreement/)) { - dataResponse = validTransactionSummaryResponse - return Promise.resolve({ data: dataResponse }) - } - if (url.match(/\/payout/)) { - dataResponse = {} - return Promise.resolve({ data: dataResponse }) - } - if (url.match(/\/transaction\?account_id.*limit_total/)) { - dataResponse = validTransactionSearchResponse - return Promise.resolve({ data: dataResponse }) - } + + if (url.match(/\.*\/event/)) dataResponse = ledgerTransactionEventsFixture + else if (url.match(/\/transaction\//)) dataResponse = validCreatedTransactionDetailsResponse + else if (url.match(/\/report\/transactions-summary/)) dataResponse = validTransactionSummaryResponse + else if (url.match(/\/agreement/)) dataResponse = validTransactionSummaryResponse + else if (url.match(/\/payout/)) dataResponse = {} + else if (url.match(/\/transaction\?account_id.*limit_total/)) dataResponse = validTransactionSearchResponse + else dataResponse = {} + + return Promise.resolve({ data: dataResponse }) } }