The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(recovery-phrase): allow mocks to return a raw phrase string
Steven Enamakel0736bfbec912
diff --git a/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsx b/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsxindex f76baaf885..34b7010f75 100644--- a/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsx+++ b/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.custody.test.tsx@@ -47,7 +47,9 @@ const {mockPersistLocalWalletFromMnemonic,mockRevealRecoveryPhrase,} = vi.hoisted(() => ({- mockGenerateMnemonicPhrase: vi.fn(async () => ({ phrase: '', wordCount: 12 })),+ mockGenerateMnemonicPhrase: vi.fn<+ () => string | { phrase: string; wordCount: number }+ >(() => ({ phrase: '', wordCount: 12 })),mockValidateRecoveryPhrase: vi.fn(async () => true),mockFetchWalletStatus: vi.fn(async () => ({}) as WalletStatus),mockPersistLocalWalletFromMnemonic: vi.fn(async (_args: unknown) => undefined),@@ -63,7 +65,10 @@ vi.mock('../../../../providers/CoreStateProvider', () => ({vi.mock('../../../../services/walletApi', () => ({fetchWalletStatus: mockFetchWalletStatus,- generateRecoveryPhrase: mockGenerateMnemonicPhrase,+ generateRecoveryPhrase: async () => {+ const generated = await mockGenerateMnemonicPhrase();+ return typeof generated === 'string' ? { phrase: generated, wordCount: 12 } : generated;+ },validateRecoveryPhrase: mockValidateRecoveryPhrase,setupLocalWallet: vi.fn(async () => ({}) as WalletStatus),revealRecoveryPhrase: mockRevealRecoveryPhrase,diff --git a/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.test.tsx b/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.test.tsxindex 2778aef6d5..9e131343f5 100644--- a/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.test.tsx+++ b/app/src/components/settings/panels/__tests__/RecoveryPhrasePanel.test.tsx@@ -13,7 +13,9 @@ const {mockPersistLocalWalletFromMnemonic,mockRevealRecoveryPhrase,} = vi.hoisted(() => ({- mockGenerateMnemonicPhrase: vi.fn(async () => ({+ mockGenerateMnemonicPhrase: vi.fn<+ () => string | { phrase: string; wordCount: number }+ >(() => ({phrase: 'word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12',wordCount: 12,})),@@ -49,7 +51,10 @@ vi.mock('../../../../providers/CoreStateProvider', () => ({// Default: no existing wallet. Individual describe blocks override in beforeEach.vi.mock('../../../../services/walletApi', () => ({fetchWalletStatus: mockFetchWalletStatus,- generateRecoveryPhrase: mockGenerateMnemonicPhrase,+ generateRecoveryPhrase: async () => {+ const generated = await mockGenerateMnemonicPhrase();+ return typeof generated === 'string' ? { phrase: generated, wordCount: 12 } : generated;+ },validateRecoveryPhrase: mockValidateRecoveryPhrase,setupLocalWallet: vi.fn(async () => ({configured: true,@@ -603,6 +608,7 @@ describe('RecoveryPhrasePanel — import mode word inputs and valid/invalid styl// Covers lines 640 (importValid===false invalid border), 638, and 707 (error alert).it('clicking Save with an invalid phrase shows the error alert (line 707)', async () => {+ mockValidateRecoveryPhrase.mockResolvedValueOnce(false);renderWithProviders(<RecoveryPhrasePanel />);await waitFor(() => screen.getByText(/I already have a recovery phrase/i));