|
1 | | -import { renderHookWithProvider } from "../../test/lib/render-helpers"; |
2 | | -import { useMultichainAccountsIntroModal, BIP44_ACCOUNTS_INTRODUCTION_VERSION } from "./useMultichainAccountsIntroModal"; |
| 1 | +import { renderHookWithProvider } from '../../test/lib/render-helpers'; |
| 2 | +import { |
| 3 | + useMultichainAccountsIntroModal, |
| 4 | + BIP44_ACCOUNTS_INTRODUCTION_VERSION, |
| 5 | +} from './useMultichainAccountsIntroModal'; |
3 | 6 |
|
4 | 7 | describe('useMultichainAccountsIntroModal', () => { |
5 | | - |
6 | | - const renderHook = (isUnlocked: boolean, isMultichainAccountsEnabled: boolean, |
| 8 | + const renderHook = ( |
| 9 | + isUnlocked: boolean, |
| 10 | + isMultichainAccountsEnabled: boolean, |
7 | 11 | hasShownMultichainAccountsIntroModal: boolean, |
8 | 12 | lastUpdatedAt: number | null, |
9 | 13 | previousAppVersion: string | null, |
10 | | - pathname: string |
| 14 | + pathname: string, |
11 | 15 | ) => { |
12 | | - return renderHookWithProvider(() => useMultichainAccountsIntroModal(isUnlocked, { pathname }), { |
13 | | - metamask: { |
14 | | - remoteFeatureFlags: { |
15 | | - enableMultichainAccountsState2: { enabled: isMultichainAccountsEnabled, featureVersion: "2", minimumVersion: BIP44_ACCOUNTS_INTRODUCTION_VERSION }, |
| 16 | + return renderHookWithProvider( |
| 17 | + () => useMultichainAccountsIntroModal(isUnlocked, { pathname }), |
| 18 | + { |
| 19 | + metamask: { |
| 20 | + remoteFeatureFlags: { |
| 21 | + enableMultichainAccountsState2: { |
| 22 | + enabled: isMultichainAccountsEnabled, |
| 23 | + featureVersion: '2', |
| 24 | + minimumVersion: BIP44_ACCOUNTS_INTRODUCTION_VERSION, |
| 25 | + }, |
| 26 | + }, |
| 27 | + hasShownMultichainAccountsIntroModal, |
| 28 | + previousAppVersion, |
| 29 | + lastUpdatedAt, |
16 | 30 | }, |
17 | | - hasShownMultichainAccountsIntroModal, |
18 | | - previousAppVersion, |
19 | | - lastUpdatedAt, |
20 | | - } |
21 | | - }); |
22 | | - } |
| 31 | + }, |
| 32 | + ); |
| 33 | + }; |
23 | 34 |
|
24 | 35 | describe('shows banner correctly', () => { |
25 | 36 | const baseParams = { |
@@ -117,14 +128,7 @@ describe('useMultichainAccountsIntroModal', () => { |
117 | 128 | }); |
118 | 129 |
|
119 | 130 | it('does NOT show for fresh install (no previous version)', () => { |
120 | | - const { result } = renderHook( |
121 | | - true, |
122 | | - true, |
123 | | - false, |
124 | | - Date.now(), |
125 | | - null, |
126 | | - '/', |
127 | | - ); |
| 131 | + const { result } = renderHook(true, true, false, Date.now(), null, '/'); |
128 | 132 | expect(result.current.showMultichainIntroModal).toBe(false); |
129 | 133 | }); |
130 | 134 |
|
@@ -177,14 +181,7 @@ describe('useMultichainAccountsIntroModal', () => { |
177 | 181 | }); |
178 | 182 |
|
179 | 183 | it('does NOT show for fresh install (lastUpdatedAt is null)', () => { |
180 | | - const { result } = renderHook( |
181 | | - true, |
182 | | - true, |
183 | | - false, |
184 | | - null, |
185 | | - '13.4.0', |
186 | | - '/', |
187 | | - ); |
| 184 | + const { result } = renderHook(true, true, false, null, '13.4.0', '/'); |
188 | 185 | expect(result.current.showMultichainIntroModal).toBe(false); |
189 | 186 | }); |
190 | 187 | }); |
|
0 commit comments