@@ -133,8 +133,6 @@ const initialState = {
133133const store = mockStore ( initialState ) ;
134134
135135describe ( 'RevealPrivateCredential' , ( ) => {
136- const SRP_CREDENTIAL = 'seed_phrase' ;
137- const PRIV_KEY_CREDENTIAL = 'private_key' ;
138136 let mockAccount : InternalAccount ;
139137
140138 beforeEach ( ( ) => {
@@ -159,13 +157,10 @@ describe('RevealPrivateCredential', () => {
159157 route = { {
160158 key : 'RevealPrivateCredential' ,
161159 name : 'RevealPrivateCredential' ,
162- params : {
163- credentialName : '' ,
164- } ,
160+ params : { } ,
165161 } }
166162 navigation = { null }
167163 cancel = { ( ) => null }
168- credentialName = { SRP_CREDENTIAL }
169164 /> ,
170165 ) ;
171166 expect ( toJSON ( ) ) . toMatchSnapshot ( ) ;
@@ -177,79 +172,25 @@ describe('RevealPrivateCredential', () => {
177172 route = { {
178173 key : 'RevealPrivateCredential' ,
179174 name : 'RevealPrivateCredential' ,
180- params : {
181- credentialName : SRP_CREDENTIAL ,
182- } ,
175+ params : { } ,
183176 } }
184177 navigation = { null }
185178 cancel = { ( ) => null }
186- // @ts -expect-error - The error is ignored for testing purposes
187- credentialName = { undefined }
188179 /> ,
189180 ) ;
190181 expect ( toJSON ( ) ) . toMatchSnapshot ( ) ;
191182 } ) ;
192183
193- it ( 'renders reveal private key correctly' , ( ) => {
194- const { toJSON } = renderWithProviders (
195- < RevealPrivateCredential
196- route = { {
197- key : 'RevealPrivateCredential' ,
198- name : 'RevealPrivateCredential' ,
199- params : {
200- credentialName : PRIV_KEY_CREDENTIAL ,
201- } ,
202- } }
203- navigation = { null }
204- cancel = { ( ) => null }
205- credentialName = { PRIV_KEY_CREDENTIAL }
206- /> ,
207- ) ;
208- expect ( toJSON ( ) ) . toMatchSnapshot ( ) ;
209- } ) ;
210-
211- it ( 'renders AccountInfo and BannerAlert for private key reveal' , ( ) => {
212- const { getByText } = renderWithProviders (
213- < RevealPrivateCredential
214- route = { {
215- key : 'RevealPrivateCredential' ,
216- name : 'RevealPrivateCredential' ,
217- params : {
218- credentialName : PRIV_KEY_CREDENTIAL ,
219- selectedAccount : mockAccount ,
220- } ,
221- } }
222- navigation = { null }
223- cancel = { ( ) => null }
224- credentialName = { PRIV_KEY_CREDENTIAL }
225- /> ,
226- ) ;
227-
228- // Should render AccountInfo for private key
229- expect ( getByText ( mockAccount . metadata . name ) ) . toBeTruthy ( ) ;
230-
231- // Should render BannerAlert for private key security warning
232- expect ( getByText ( 'Never disclose this key.' ) ) . toBeTruthy ( ) ;
233- expect (
234- getByText (
235- 'Anyone with your private key can steal any assets held in your account.' ,
236- ) ,
237- ) . toBeTruthy ( ) ;
238- } ) ;
239-
240184 it ( 'renders SRP explanation for seed phrase reveal' , ( ) => {
241185 const { getByText } = renderWithProviders (
242186 < RevealPrivateCredential
243187 route = { {
244188 key : 'RevealPrivateCredential' ,
245189 name : 'RevealPrivateCredential' ,
246- params : {
247- credentialName : SRP_CREDENTIAL ,
248- } ,
190+ params : { } ,
249191 } }
250192 navigation = { null }
251193 cancel = { ( ) => null }
252- credentialName = { SRP_CREDENTIAL }
253194 /> ,
254195 ) ;
255196
@@ -263,13 +204,10 @@ describe('RevealPrivateCredential', () => {
263204 route = { {
264205 key : 'RevealPrivateCredential' ,
265206 name : 'RevealPrivateCredential' ,
266- params : {
267- credentialName : SRP_CREDENTIAL ,
268- } ,
207+ params : { } ,
269208 } }
270209 navigation = { null }
271210 cancel = { ( ) => null }
272- credentialName = { SRP_CREDENTIAL }
273211 /> ,
274212 ) ;
275213 const passwordInput = getByPlaceholderText ( 'Password' ) ;
@@ -289,13 +227,10 @@ describe('RevealPrivateCredential', () => {
289227 route = { {
290228 key : 'RevealPrivateCredential' ,
291229 name : 'RevealPrivateCredential' ,
292- params : {
293- credentialName : SRP_CREDENTIAL ,
294- } ,
230+ params : { } ,
295231 } }
296232 navigation = { null }
297233 cancel = { ( ) => null }
298- credentialName = { SRP_CREDENTIAL }
299234 /> ,
300235 ) ;
301236 const passwordInput = getByPlaceholderText ( 'Password' ) ;
@@ -308,57 +243,6 @@ describe('RevealPrivateCredential', () => {
308243 } ) ;
309244 } ) ;
310245
311- it ( 'renders with a custom selectedAddress' , async ( ) => {
312- const customMockAccount : InternalAccount = {
313- type : EthAccountType . Eoa ,
314- id : 'unique-account-id-1' ,
315- address : '0x1234567890123456789012345678901234567890' ,
316- options : {
317- someOption : 'optionValue' ,
318- anotherOption : 42 ,
319- } ,
320- scopes : [ EthScope . Eoa ] ,
321- methods : [
322- EthMethod . PersonalSign ,
323- EthMethod . SignTransaction ,
324- EthMethod . SignTypedDataV1 ,
325- EthMethod . SignTypedDataV3 ,
326- EthMethod . SignTypedDataV4 ,
327- ] ,
328- metadata : {
329- name : 'Test Account' ,
330- importTime : Date . now ( ) ,
331- keyring : {
332- type : KeyringTypes . hd ,
333- } ,
334- nameLastUpdatedAt : Date . now ( ) ,
335- snap : {
336- id : 'npm:@metamask/test-snap' ,
337- name : 'Test Snap' ,
338- enabled : true ,
339- } ,
340- lastSelected : Date . now ( ) ,
341- } ,
342- } ;
343-
344- const { toJSON } = renderWithProviders (
345- < RevealPrivateCredential
346- route = { {
347- key : 'RevealPrivateCredential' ,
348- name : 'RevealPrivateCredential' ,
349- params : {
350- credentialName : PRIV_KEY_CREDENTIAL ,
351- selectedAccount : customMockAccount ,
352- } ,
353- } }
354- navigation = { null }
355- cancel = { ( ) => null }
356- credentialName = { PRIV_KEY_CREDENTIAL }
357- /> ,
358- ) ;
359- expect ( toJSON ( ) ) . toMatchSnapshot ( ) ;
360- } ) ;
361-
362246 it ( 'renders TabView when unlocked' , async ( ) => {
363247 const mockEngine = jest . requireMock ( '../../../core/Engine' ) ;
364248 mockEngine . context . KeyringController . verifyPassword . mockResolvedValue ( true ) ;
@@ -371,13 +255,10 @@ describe('RevealPrivateCredential', () => {
371255 route = { {
372256 key : 'RevealPrivateCredential' ,
373257 name : 'RevealPrivateCredential' ,
374- params : {
375- credentialName : SRP_CREDENTIAL ,
376- } ,
258+ params : { } ,
377259 } }
378260 navigation = { null }
379261 cancel = { ( ) => null }
380- credentialName = { SRP_CREDENTIAL }
381262 /> ,
382263 ) ;
383264
@@ -403,13 +284,10 @@ describe('RevealPrivateCredential', () => {
403284 route = { {
404285 key : 'RevealPrivateCredential' ,
405286 name : 'RevealPrivateCredential' ,
406- params : {
407- credentialName : SRP_CREDENTIAL ,
408- } ,
287+ params : { } ,
409288 } }
410289 navigation = { null }
411290 cancel = { ( ) => null }
412- credentialName = { SRP_CREDENTIAL }
413291 /> ,
414292 ) ;
415293
@@ -423,13 +301,10 @@ describe('RevealPrivateCredential', () => {
423301 route = { {
424302 key : 'RevealPrivateCredential' ,
425303 name : 'RevealPrivateCredential' ,
426- params : {
427- credentialName : SRP_CREDENTIAL ,
428- } ,
304+ params : { } ,
429305 } }
430306 navigation = { null }
431307 cancel = { ( ) => null }
432- credentialName = { SRP_CREDENTIAL }
433308 /> ,
434309 ) ;
435310
@@ -452,13 +327,11 @@ describe('RevealPrivateCredential', () => {
452327 key : 'RevealPrivateCredential' ,
453328 name : 'RevealPrivateCredential' ,
454329 params : {
455- credentialName : SRP_CREDENTIAL ,
456330 shouldUpdateNav : true ,
457331 } ,
458332 } }
459333 navigation = { mockNavigation }
460334 cancel = { ( ) => null }
461- credentialName = { SRP_CREDENTIAL }
462335 /> ,
463336 ) ;
464337
@@ -476,13 +349,11 @@ describe('RevealPrivateCredential', () => {
476349 key : 'RevealPrivateCredential' ,
477350 name : 'RevealPrivateCredential' ,
478351 params : {
479- credentialName : SRP_CREDENTIAL ,
480352 keyringId : testKeyringId ,
481353 } ,
482354 } }
483355 navigation = { null }
484356 cancel = { ( ) => null }
485- credentialName = { SRP_CREDENTIAL }
486357 /> ,
487358 ) ;
488359
0 commit comments