diff options
| author | cyan <cyjan@mrcyjanek.net> | 2025-01-16 09:37:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-16 09:37:11 +0100 |
| commit | 9526921acb774b523a2e1d9ba9a7b389acfc6b70 (patch) | |
| tree | 7aae5612302482f1f76cb2f37a4d5c134611e0f5 /tests/integration.test.ts | |
| parent | b4c3fbacab594bd1e67e71602a1ac07f0c19a77f (diff) | |
extra case for bgsync (#107)
Diffstat (limited to 'tests/integration.test.ts')
| -rw-r--r-- | tests/integration.test.ts | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/integration.test.ts b/tests/integration.test.ts index 2570874..eb478f7 100644 --- a/tests/integration.test.ts +++ b/tests/integration.test.ts @@ -238,11 +238,12 @@ Deno.test("0001-polyseed.patch", async (t) => { } }); -Deno.test("0002-wallet-background-sync-with-just-the-view-key.patch", async () => { +Deno.test("0002-wallet-background-sync-with-just-the-view-key.patch (close)", async () => { await clearWallets(); const walletManager = await WalletManager.new(); const wallet = await walletManager.createWallet("tests/wallets/squirrel", "belka"); + await wallet.setRefreshFromBlockHeight(3310000n); await wallet.init({ address: NODE_URL, }); @@ -289,6 +290,51 @@ Deno.test("0002-wallet-background-sync-with-just-the-view-key.patch", async () = await reopenedWallet.close(true); }); +Deno.test("0002-wallet-background-sync-with-just-the-view-key.patch (stopBackgroundSync)", async () => { + await clearWallets(); + + const walletManager = await WalletManager.new(); + const wallet = await walletManager.createWallet("tests/wallets/squirrel", "belka"); + await wallet.setRefreshFromBlockHeight(3310000n); + await wallet.init({ + address: NODE_URL, + }); + + + const walletInfo = { + address: await wallet.address(), + publicSpendKey: await wallet.publicSpendKey(), + secretSpendKey: await wallet.secretSpendKey(), + publicViewKey: await wallet.publicViewKey(), + secretViewKey: await wallet.secretViewKey(), + }; + + await wallet.setupBackgroundSync(2, "belka", "background-belka"); + await wallet.startBackgroundSync(); + + + await wallet.init({ address: NODE_URL }); + await wallet.refreshAsync(); + + const blockChainHeight = await syncBlockchain(wallet); + + await wallet.stopBackgroundSync("belka"); + + assertEquals(await wallet.blockChainHeight(), blockChainHeight); + assertEquals( + walletInfo, + { + address: await wallet.address(), + publicSpendKey: await wallet.publicSpendKey(), + secretSpendKey: await wallet.secretSpendKey(), + publicViewKey: await wallet.publicViewKey(), + secretViewKey: await wallet.secretViewKey(), + }, + ); + + await wallet.close(true); +}); + Deno.test("0004-coin-control.patch", { ignore: coin === "wownero" || !( Deno.env.get("SECRET_WALLET_PASSWORD") && |
