Skip to content

adds e2e test showing the alternative way to create accounts #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
});
Loading