From 3d32bf84f865d5bdccf97e07a68292c8380c9075 Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 23 Sep 2024 20:44:16 +0000
Subject: [PATCH 01/11] chore(js-ts): Convert
app/components/Views/OnboardingSuccess/index.test.js to TypeScript
---
.../{index.test.js => index.test.tsx} | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
rename app/components/Views/OnboardingSuccess/{index.test.js => index.test.tsx} (78%)
diff --git a/app/components/Views/OnboardingSuccess/index.test.js b/app/components/Views/OnboardingSuccess/index.test.tsx
similarity index 78%
rename from app/components/Views/OnboardingSuccess/index.test.js
rename to app/components/Views/OnboardingSuccess/index.test.tsx
index 010edac55dd..5a465b79bbe 100644
--- a/app/components/Views/OnboardingSuccess/index.test.js
+++ b/app/components/Views/OnboardingSuccess/index.test.tsx
@@ -8,6 +8,12 @@ import { useNavigation } from '@react-navigation/native';
import { useSelector } from 'react-redux';
import { selectProviderConfig } from '../../../selectors/networkController';
+// Define ProviderConfig type
+interface ProviderConfig {
+ type: string;
+ chainId: string;
+}
+
jest.mock('@react-navigation/native', () => {
const actualReactNavigation = jest.requireActual('@react-navigation/native');
return {
@@ -29,18 +35,18 @@ jest.mock('react-redux', () => ({
useSelector: jest.fn(),
}));
-const mockProviderConfig = {
+const mockProviderConfig: ProviderConfig = {
type: 'mainnet',
chainId: '1',
};
describe('OnboardingSuccess', () => {
it('should render correctly', () => {
- useSelector.mockImplementation((selector) => {
+ (useSelector as jest.Mock).mockImplementation((selector: typeof selectProviderConfig) => {
if (selector === selectProviderConfig) return mockProviderConfig;
});
const { toJSON } = renderWithProvider(
- ,
+ ,
);
expect(toJSON()).toMatchSnapshot();
});
From 2f91540f5da698c7d7e8a61a8251c5167205f57b Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 23 Sep 2024 20:54:50 +0000
Subject: [PATCH 02/11] Convert index.test.js to TypeScript
---
app/components/Views/OnboardingSuccess/index.test.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/components/Views/OnboardingSuccess/index.test.tsx b/app/components/Views/OnboardingSuccess/index.test.tsx
index 5a465b79bbe..ec51b616327 100644
--- a/app/components/Views/OnboardingSuccess/index.test.tsx
+++ b/app/components/Views/OnboardingSuccess/index.test.tsx
@@ -4,7 +4,6 @@ import React from 'react';
// Internal dependencies.
import OnboardingSuccess from './';
import renderWithProvider from '../../../util/test/renderWithProvider';
-import { useNavigation } from '@react-navigation/native';
import { useSelector } from 'react-redux';
import { selectProviderConfig } from '../../../selectors/networkController';
From 4f84fc4754c1b8772196eb2d4c91ed16e4718001 Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 23 Sep 2024 21:07:42 +0000
Subject: [PATCH 03/11] chore: Rename snapshot file to .ts.snap
---
.../__snapshots__/{index.test.js.snap => index.test.ts.snap} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename app/components/Views/OnboardingSuccess/__snapshots__/{index.test.js.snap => index.test.ts.snap} (100%)
diff --git a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.js.snap b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.ts.snap
similarity index 100%
rename from app/components/Views/OnboardingSuccess/__snapshots__/index.test.js.snap
rename to app/components/Views/OnboardingSuccess/__snapshots__/index.test.ts.snap
From d23b53f2af3c1614de1e1c8ae5b10607fd963e9f Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 23 Sep 2024 21:19:20 +0000
Subject: [PATCH 04/11] chore: Rename snapshot file to .tsx.snap
---
.../__snapshots__/{index.test.ts.snap => index.test.tsx.snap} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename app/components/Views/OnboardingSuccess/__snapshots__/{index.test.ts.snap => index.test.tsx.snap} (100%)
diff --git a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.ts.snap b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
similarity index 100%
rename from app/components/Views/OnboardingSuccess/__snapshots__/index.test.ts.snap
rename to app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
From 2b376913f4cc38f80f83558964aa1b8eb55269fb Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 23 Sep 2024 21:59:19 +0000
Subject: [PATCH 05/11] Fix test for OnboardingSuccess component
---
.../Views/OnboardingSuccess/index.test.tsx | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/app/components/Views/OnboardingSuccess/index.test.tsx b/app/components/Views/OnboardingSuccess/index.test.tsx
index ec51b616327..0f545d19678 100644
--- a/app/components/Views/OnboardingSuccess/index.test.tsx
+++ b/app/components/Views/OnboardingSuccess/index.test.tsx
@@ -6,6 +6,7 @@ import OnboardingSuccess from './';
import renderWithProvider from '../../../util/test/renderWithProvider';
import { useSelector } from 'react-redux';
import { selectProviderConfig } from '../../../selectors/networkController';
+import Button from '../../../component-library/components/Buttons/Button/Button';
// Define ProviderConfig type
interface ProviderConfig {
@@ -40,13 +41,25 @@ const mockProviderConfig: ProviderConfig = {
};
describe('OnboardingSuccess', () => {
- it('should render correctly', () => {
+ it('should render correctly and handle onDone', () => {
(useSelector as jest.Mock).mockImplementation((selector: typeof selectProviderConfig) => {
if (selector === selectProviderConfig) return mockProviderConfig;
});
- const { toJSON } = renderWithProvider(
- ,
+ const mockOnDone = jest.fn();
+ const { getByTestId, toJSON } = renderWithProvider(
+ ,
);
+
+ // Snapshot test
expect(toJSON()).toMatchSnapshot();
+
+ const doneButton = getByTestId('onboarding-success-done-button');
+ expect(doneButton).toBeTruthy();
+
+ // Simulate button press
+ doneButton.props.onPress();
+
+ // Check if mockOnDone was called
+ expect(mockOnDone).toHaveBeenCalledTimes(1);
});
});
From 88c16e12e47b3eb4ed1a13cf38d2846ae8e1e1b2 Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 23 Sep 2024 23:05:43 +0000
Subject: [PATCH 06/11] fix: Remove unused import in index.test.tsx
---
app/components/Views/OnboardingSuccess/index.test.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/components/Views/OnboardingSuccess/index.test.tsx b/app/components/Views/OnboardingSuccess/index.test.tsx
index 0f545d19678..07c47f85c65 100644
--- a/app/components/Views/OnboardingSuccess/index.test.tsx
+++ b/app/components/Views/OnboardingSuccess/index.test.tsx
@@ -6,7 +6,6 @@ import OnboardingSuccess from './';
import renderWithProvider from '../../../util/test/renderWithProvider';
import { useSelector } from 'react-redux';
import { selectProviderConfig } from '../../../selectors/networkController';
-import Button from '../../../component-library/components/Buttons/Button/Button';
// Define ProviderConfig type
interface ProviderConfig {
From 46f752f5ea4918f440b8185e03034e5cb7dbfed7 Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 23 Sep 2024 23:25:28 +0000
Subject: [PATCH 07/11] chore: Update snapshot for OnboardingSuccess component
---
.../Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
index 719f3b38306..f6548b7406b 100644
--- a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
+++ b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`OnboardingSuccess should render correctly 1`] = `
+exports[`OnboardingSuccess should render correctly and handle onDone 1`] = `
Date: Wed, 25 Sep 2024 23:26:29 +0000
Subject: [PATCH 08/11] commit to trigger CI
From 739508a970c044bbabdd6edbe98d2b153e9662b4 Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Wed, 25 Sep 2024 23:31:23 +0000
Subject: [PATCH 09/11] commit to trigger CI
From e367b617bff2585743937c1f4558ab06c4fd82b7 Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Tue, 1 Oct 2024 12:54:51 +0000
Subject: [PATCH 10/11] fixing review comments
---
.../__snapshots__/index.test.tsx.snap | 261 ++++++++++++++++++
.../Views/OnboardingSuccess/index.test.tsx | 15 +-
2 files changed, 267 insertions(+), 9 deletions(-)
diff --git a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
index f6548b7406b..fef937c16dd 100644
--- a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
+++ b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
@@ -1,5 +1,266 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`OnboardingSuccess should render correctly 1`] = `
+
+
+
+
+ 🎉
+
+
+ Your Wallet is ready
+
+
+
+ Remember, if you lose your Secret Recovery Phrase, you lose access to your wallet.
+
+
+ Learn how
+
+
+ to keep this set of words safe so you can always access your funds.
+
+
+
+
+
+
+
+
+
+ Manage default settings
+
+
+
+ Settings are optimized for ease of use and security.
+Change these at any time.
+
+
+
+
+
+
+ Done
+
+
+
+
+
+
+`;
+
exports[`OnboardingSuccess should render correctly and handle onDone 1`] = `
{
const actualReactNavigation = jest.requireActual('@react-navigation/native');
@@ -36,11 +30,14 @@ jest.mock('react-redux', () => ({
const mockProviderConfig: ProviderConfig = {
type: 'mainnet',
- chainId: '1',
+ chainId: '0x1',
+ ticker: '',
+ rpcUrl: '',
+ nickname: undefined
};
describe('OnboardingSuccess', () => {
- it('should render correctly and handle onDone', () => {
+ it('should render correctly', () => {
(useSelector as jest.Mock).mockImplementation((selector: typeof selectProviderConfig) => {
if (selector === selectProviderConfig) return mockProviderConfig;
});
From f2e7c45aa47f800ff5929669a69de5795d2a5bfb Mon Sep 17 00:00:00 2001
From: "devin-ai-integration[bot]"
<158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Tue, 1 Oct 2024 13:31:36 +0000
Subject: [PATCH 11/11] fixing snapshot
---
.../__snapshots__/index.test.tsx.snap | 261 ------------------
1 file changed, 261 deletions(-)
diff --git a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
index fef937c16dd..46ad55f232c 100644
--- a/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
+++ b/app/components/Views/OnboardingSuccess/__snapshots__/index.test.tsx.snap
@@ -260,264 +260,3 @@ Change these at any time.
`;
-
-exports[`OnboardingSuccess should render correctly and handle onDone 1`] = `
-
-
-
-
- 🎉
-
-
- Your Wallet is ready
-
-
-
- Remember, if you lose your Secret Recovery Phrase, you lose access to your wallet.
-
-
- Learn how
-
-
- to keep this set of words safe so you can always access your funds.
-
-
-
-
-
-
-
-
-
- Manage default settings
-
-
-
- Settings are optimized for ease of use and security.
-Change these at any time.
-
-
-
-
-
-
- Done
-
-
-
-
-
-
-`;