-
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.
Fix 'Jest did not exit one second after the test run has completed. (#…
…160) This usually means that there are asynchronous operations that weren't stopped in your tests.' Co-authored-by: Aaron <[email protected]>
- Loading branch information
Showing
5 changed files
with
122 additions
and
104 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,26 +1,30 @@ | ||
import { newKitFromWeb3 } from '@celo/contractkit' | ||
import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' | ||
import Web3 from 'web3' | ||
import { testLocally } from '../../test-utils/cliUtils' | ||
import { LONG_TIMEOUT_MS, testLocally } from '../../test-utils/cliUtils' | ||
import Register from '../account/register' | ||
import Lock from './lock' | ||
import Unlock from './unlock' | ||
|
||
process.env.NO_SYNCCHECK = 'true' | ||
|
||
testWithGanache('lockedgold:lock cmd', (web3: Web3) => { | ||
test('can lock with pending withdrawals', async () => { | ||
const accounts = await web3.eth.getAccounts() | ||
const account = accounts[0] | ||
const kit = newKitFromWeb3(web3) | ||
const lockedGold = await kit.contracts.getLockedGold() | ||
await testLocally(Register, ['--from', account]) | ||
await testLocally(Lock, ['--from', account, '--value', '100']) | ||
await testLocally(Unlock, ['--from', account, '--value', '50']) | ||
await testLocally(Lock, ['--from', account, '--value', '75']) | ||
await testLocally(Unlock, ['--from', account, '--value', '50']) | ||
await testLocally(Lock, ['--from', account, '--value', '50']) | ||
const pendingWithdrawalsTotalValue = await lockedGold.getPendingWithdrawalsTotalValue(account) | ||
expect(pendingWithdrawalsTotalValue.toFixed()).toBe('0') | ||
}) | ||
test( | ||
'can lock with pending withdrawals', | ||
async () => { | ||
const accounts = await web3.eth.getAccounts() | ||
const account = accounts[0] | ||
const kit = newKitFromWeb3(web3) | ||
const lockedGold = await kit.contracts.getLockedGold() | ||
await testLocally(Register, ['--from', account]) | ||
await testLocally(Lock, ['--from', account, '--value', '100']) | ||
await testLocally(Unlock, ['--from', account, '--value', '50']) | ||
await testLocally(Lock, ['--from', account, '--value', '75']) | ||
await testLocally(Unlock, ['--from', account, '--value', '50']) | ||
await testLocally(Lock, ['--from', account, '--value', '50']) | ||
const pendingWithdrawalsTotalValue = await lockedGold.getPendingWithdrawalsTotalValue(account) | ||
expect(pendingWithdrawalsTotalValue.toFixed()).toBe('0') | ||
}, | ||
LONG_TIMEOUT_MS | ||
) | ||
}) |
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
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