Skip to content

Commit

Permalink
adds e2e test showing the alternative way to create accounts (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemolding authored Oct 24, 2024
1 parent 86e928c commit 029dd43
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/e2e-tests/e2e/web_wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { test, expect } from '@playwright/test';
import { WebWallet } from "@webzjs/webz-wallet";

import type * as WebZKeys from "@webzjs/webz-keys";
declare global {
interface Window { webWallet: WebWallet; }
interface Window {
webWallet: WebWallet;
WebZKeys: typeof WebZKeys;
}
}

const SEED = "mix sample clay sweet planet lava giraffe hand fashion switch away pool rookie earth purity truly square trumpet goose move actor save jaguar volume";
Expand Down Expand Up @@ -30,3 +34,16 @@ test('Wallet can be serialized', async ({ page }) => {
return bytes;
});
});

test('Accont can be added from ufvk', async ({ page }) => {
let result = await page.evaluate(async () => {
let seed = new Uint8Array(32);
let birthday = 2657762;
let usk = new window.WebZKeys.UnifiedSpendingKey("main", seed, 0);
let ufvk = usk.to_unified_full_viewing_key();
await window.webWallet.create_account_ufvk(ufvk.encode("main"), birthday);
let summary = await window.webWallet.get_wallet_summary();
return summary?.account_balances.length;
});
expect(result).toBe(2);
});

1 comment on commit 029dd43

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.