From e9d9d728a819428b1a792792656398c4ad26adff Mon Sep 17 00:00:00 2001 From: JJ Adonis Date: Wed, 4 Aug 2021 14:20:06 +0800 Subject: [PATCH] update address url (#415) --- .../functional/balances/send.spec.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cypress/integration/functional/balances/send.spec.ts b/cypress/integration/functional/balances/send.spec.ts index 338b1eb32f..6cf94b519b 100644 --- a/cypress/integration/functional/balances/send.spec.ts +++ b/cypress/integration/functional/balances/send.spec.ts @@ -1,3 +1,4 @@ +import { WhaleApiClient } from '@defichain/whale-api-client' import BigNumber from 'bignumber.js' context('wallet/send', () => { @@ -84,16 +85,12 @@ context('wallet/send', () => { }) it(`should check if exist on other side ${address}`, function () { - // TODO(jj): we should inject a WhaleClient into cypress global for operations - // such as this as versioning is automatically handled there - let url: string - if (network === 'Playground') { - url = 'https://playground.defichain.com/v0.8/regtest' - } else { - url = 'http://localhost:19553/v0.8/regtest' - } - cy.request(`${url}/address/${address}/balance`).then((response) => { - expect(response.body).to.have.property('data', '1.00000000') + const whale = new WhaleApiClient({ + url: network === 'Playground' ? 'https://playground.defichain.com' : 'http://localhost:19553', + network: 'regtest' + }) + cy.wrap(whale.address.getBalance(address)).then((response) => { + expect(response).eq('1.00000000') }) })