-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into chore/wallet-ledger-v-coverage
- Loading branch information
Showing
4 changed files
with
121 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
coverage: | ||
status: | ||
project: | ||
patch: | ||
default: | ||
# basic | ||
target: auto | ||
threshold: null | ||
removed_code_behavior: adjust_base | ||
celotool: | ||
paths: | ||
- packages/celotool | ||
celocli: | ||
paths: | ||
- packages/cli | ||
sdk: | ||
paths: | ||
- packages/sdk | ||
patch: off | ||
threshold: 0% | ||
base: auto | ||
only_pulls: true | ||
comment: | ||
layout: 'header, diff, flags, components' | ||
|
||
ignore: | ||
- 'packages/typescript' | ||
- 'docs' | ||
- '.github' | ||
- '.changeset' | ||
|
||
component_management: | ||
default_rules: | ||
statuses: | ||
- type: project | ||
target: auto | ||
branches: | ||
- '!master' | ||
individual_components: | ||
- component_id: celocli | ||
name: celocli | ||
paths: | ||
- packages/cli | ||
- component_id: dev-utils | ||
name: dev-utils | ||
paths: | ||
- packages/dev-utils | ||
- component_id: sdks | ||
name: sdk | ||
paths: | ||
- '!packages/sdk/wallets' | ||
- 'packages/sdk/*' | ||
- component_id: wallets | ||
name: wallets | ||
paths: | ||
- 'packages/sdk/wallets/*' | ||
- component_id: viem-sdks | ||
name: viem-sdks | ||
paths: | ||
- 'packages/viem-*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { ContractKit, newKitFromWeb3, StableToken } from '@celo/contractkit' | ||
import { testWithAnvilL2 } from '@celo/dev-utils/lib/anvil-test' | ||
import BigNumber from 'bignumber.js' | ||
import Web3 from 'web3' | ||
import { topUpWithToken } from '../../test-utils/chain-setup' | ||
import { stripAnsiCodesFromNestedArray, testLocallyWithWeb3Node } from '../../test-utils/cliUtils' | ||
import Balance from './balance' | ||
|
||
process.env.NO_SYNCCHECK = 'true' | ||
|
||
testWithAnvilL2('account:set-name cmd', (web3: Web3) => { | ||
const consoleMock = jest.spyOn(console, 'log') | ||
let accounts: string[] = [] | ||
let kit: ContractKit | ||
|
||
beforeEach(async () => { | ||
kit = newKitFromWeb3(web3) | ||
accounts = await web3.eth.getAccounts() | ||
consoleMock.mockClear() | ||
}) | ||
|
||
it('shows the balance of the account in several currencies', async () => { | ||
await testLocallyWithWeb3Node(Balance, [accounts[0]], web3) | ||
|
||
expect(stripAnsiCodesFromNestedArray(consoleMock.mock.calls)).toMatchInlineSnapshot(` | ||
[ | ||
[ | ||
"All balances expressed in units of 10^-18.", | ||
], | ||
[ | ||
"lockedCELO: 0 | ||
pending: 0 | ||
CELO: 1e+24 | ||
cUSD: 0 | ||
cEUR: 0 | ||
cREAL: 0", | ||
], | ||
] | ||
`) | ||
}) | ||
|
||
it('shows the balance of the account in given currency', async () => { | ||
const amount = new BigNumber('1234567890000000000000') | ||
await topUpWithToken(kit, StableToken.cUSD, accounts[0], amount) | ||
|
||
await testLocallyWithWeb3Node( | ||
Balance, | ||
[ | ||
accounts[0], | ||
'--erc20Address', | ||
(await kit.contracts.getStableToken(StableToken.cUSD)).address, | ||
], | ||
web3 | ||
) | ||
|
||
expect(stripAnsiCodesFromNestedArray(consoleMock.mock.calls)).toMatchInlineSnapshot(` | ||
[ | ||
[ | ||
"All balances expressed in units of 10^-18.", | ||
], | ||
[ | ||
"lockedCELO: 0 | ||
pending: 0 | ||
CELO: 1e+24 | ||
cUSD: ${amount.toExponential()} | ||
cEUR: 0 | ||
cREAL: 0", | ||
], | ||
[ | ||
"erc20: ${amount.toExponential()}", | ||
], | ||
] | ||
`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters