Skip to content

Commit

Permalink
Added a failing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
aikchun committed Jun 11, 2021
1 parent 2edd638 commit 694f6d3
Showing 1 changed file with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { MasterNodeRegTestContainer, RegTestContainer } from '@defichain/testcontainers'
import { ContainerAdapterClient } from '../../container_adapter_client'
import { BigNumber } from '../../../src'
import { WalletFlag } from '../../../src/category/wallet'
Expand Down Expand Up @@ -39,4 +39,40 @@ describe('getBalances on masternode', () => {

expect(typeof balances.watchonly).toStrictEqual('undefined')
})

it('should show balances after transfer', async () => {
const balance = await client.wallet.getBalances()

const address = await client.wallet.getNewAddress()

await client.wallet.sendToAddress(address, 10000)
await container.generate(1)

const newBalance = await client.wallet.getBalances()

console.log('balance.mine.trusted', balance.mine.trusted.toNumber())
console.log('newBalance.mine.trusted', balance.mine.trusted.toNumber())

expect(newBalance.mine.trusted.toNumber() - balance.mine.trusted.toNumber()).toBeGreaterThan(10000)
})
})

describe('getBalances without masternode', () => {
const container = new RegTestContainer()
const client = new ContainerAdapterClient(container)

beforeAll(async () => {
await container.start()
await container.waitForReady()
})

afterAll(async () => {
await container.stop()
})

it('should getBalances.mine.trusted = 0', async () => {
const balances = await client.wallet.getBalances()

expect(balances.mine.trusted.toNumber()).toStrictEqual(0)
})
})

0 comments on commit 694f6d3

Please sign in to comment.