-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jellyfish-api-core): add wallet listWallets RPC (#953)
* add list wallets rpc * use testing package for container creation * tweak value assignment as per suggestion Co-authored-by: Fuxing Loh <[email protected]> * split wallets generation and expect test * further update tests based on feedback Co-authored-by: Fuxing Loh <[email protected]>
- Loading branch information
Showing
3 changed files
with
63 additions
and
0 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
41 changes: 41 additions & 0 deletions
41
packages/jellyfish-api-core/__tests__/category/wallet/listWallets.test.ts
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,41 @@ | ||
import { Testing } from '@defichain/jellyfish-testing' | ||
import { MasterNodeRegTestContainer, RegTestContainer } from '@defichain/testcontainers' | ||
import { ContainerAdapterClient } from '../../container_adapter_client' | ||
|
||
describe('Wallet without masternode', () => { | ||
const container = new RegTestContainer() | ||
const client = new ContainerAdapterClient(container) | ||
|
||
beforeAll(async () => { | ||
await container.start() | ||
await client.wallet.createWallet('test') | ||
}) | ||
|
||
afterAll(async () => { | ||
await container.stop() | ||
}) | ||
|
||
it('should listWallets', async () => { | ||
const wallets = await client.wallet.listWallets() | ||
expect(wallets).toStrictEqual(['', 'test']) | ||
}) | ||
}) | ||
|
||
describe('Wallet with masternode', () => { | ||
const master = new MasterNodeRegTestContainer() | ||
const testing = Testing.create(master) | ||
|
||
beforeAll(async () => { | ||
await testing.container.start() | ||
await testing.rpc.wallet.createWallet('test') | ||
}) | ||
|
||
afterAll(async () => { | ||
await testing.container.stop() | ||
}) | ||
|
||
it('should listWallets', async () => { | ||
const wallets = await testing.rpc.wallet.listWallets() | ||
expect(wallets).toEqual(['', 'test']) | ||
}) | ||
}) |
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