Skip to content

Commit f1d5d0d

Browse files
chore(ramps): remove dead Deposit SDK test helpers and types
Delete unused depositSdk type, webviewModalParams re-export shim, and orphaned Deposit-stack mock helpers left after navigator removal. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent c89a7f3 commit f1d5d0d

4 files changed

Lines changed: 0 additions & 370 deletions

File tree

Lines changed: 0 additions & 306 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import { FIAT_ORDER_STATES } from '../../../../constants/on-ramp';
22
import {
33
DepositOrderType,
4-
BuyQuote,
54
DepositOrder,
65
type DepositRegion,
76
type DepositPaymentMethod,
87
DepositPaymentMethodDuration,
9-
NativeTransakUserDetails,
10-
NativeTransakUserDetailsKycDetails,
118
} from '../types/legacyDeposit';
129
import { IconName } from '../../../../component-library/components/Icons/Icon';
13-
import type { DepositSDK } from '../types/depositSdk';
1410
import {
1511
MOCK_USDC_TOKEN,
1612
MOCK_USDT_TOKEN,
@@ -33,67 +29,6 @@ export const MOCK_US_REGION: DepositRegion = {
3329
supported: true,
3430
};
3531

36-
export const MOCK_EUR_REGION: DepositRegion = {
37-
isoCode: 'DE',
38-
flag: '🇩🇪',
39-
name: 'Germany',
40-
currency: 'EUR',
41-
phone: {
42-
prefix: '+49',
43-
placeholder: '30 12345678',
44-
template: '## ########',
45-
},
46-
supported: true,
47-
};
48-
49-
export const MOCK_CA_REGION: DepositRegion = {
50-
isoCode: 'CA',
51-
flag: '🇨🇦',
52-
name: 'Canada',
53-
currency: 'CAD',
54-
phone: {
55-
prefix: '+1',
56-
placeholder: '(555) 123-4567',
57-
template: '(###) ###-####',
58-
},
59-
supported: true,
60-
};
61-
62-
export const MOCK_UNSUPPORTED_REGION: DepositRegion = {
63-
isoCode: 'XX',
64-
flag: '🏳️',
65-
name: 'Unsupported Country',
66-
currency: 'USD',
67-
supported: false,
68-
phone: {
69-
prefix: '+1',
70-
placeholder: '(555) 123-4567',
71-
template: '(###) ###-####',
72-
},
73-
};
74-
75-
export const MOCK_FR_REGION: DepositRegion = {
76-
isoCode: 'FR',
77-
flag: '🇫🇷',
78-
name: 'France',
79-
phone: {
80-
prefix: '+33',
81-
placeholder: '1 23 45 67 89',
82-
template: 'X XX XX XX XX',
83-
},
84-
currency: 'EUR',
85-
supported: true,
86-
};
87-
88-
export const MOCK_REGIONS: DepositRegion[] = [MOCK_US_REGION, MOCK_EUR_REGION];
89-
90-
export const MOCK_REGIONS_EXTENDED: DepositRegion[] = [
91-
{ ...MOCK_US_REGION, recommended: true },
92-
MOCK_EUR_REGION,
93-
{ ...MOCK_CA_REGION, supported: false },
94-
MOCK_FR_REGION,
95-
];
96-
9732
// ====== CRYPTOCURRENCIES ======
9833
// Re-exported from constants/mockCryptoCurrencies.ts
9934
export {
@@ -112,50 +47,6 @@ export const MOCK_CREDIT_DEBIT_CARD: DepositPaymentMethod = {
11247
icon: IconName.Card,
11348
};
11449

115-
export const MOCK_SEPA_BANK_TRANSFER_PAYMENT_METHOD: DepositPaymentMethod = {
116-
id: 'sepa_bank_transfer',
117-
name: 'SEPA Bank Transfer',
118-
shortName: 'SEPA',
119-
duration: DepositPaymentMethodDuration.oneToTwoDays,
120-
icon: IconName.Bank,
121-
};
122-
123-
export const MOCK_APPLE_PAY: DepositPaymentMethod = {
124-
id: 'apple_pay',
125-
name: 'Apple Pay',
126-
duration: DepositPaymentMethodDuration.instant,
127-
icon: IconName.Apple,
128-
iconColor: {
129-
light: 'var(--color-icon-default)',
130-
dark: 'var(--color-icon-default)',
131-
},
132-
};
133-
134-
export const MOCK_PAYMENT_METHODS: DepositPaymentMethod[] = [
135-
MOCK_CREDIT_DEBIT_CARD,
136-
MOCK_APPLE_PAY,
137-
];
138-
139-
export const MOCK_BUY_QUOTE: BuyQuote = {
140-
quoteId: 'test-quote-id',
141-
conversionPrice: 2000,
142-
marketConversionPrice: 2000,
143-
slippage: 0.01,
144-
fiatCurrency: 'USD',
145-
cryptoCurrency: 'USDC',
146-
paymentMethod: 'credit_debit_card',
147-
fiatAmount: 100,
148-
cryptoAmount: 0.05,
149-
isBuyOrSell: 'buy',
150-
network: 'eip155:1',
151-
feeDecimal: 0.025,
152-
totalFee: 2.5,
153-
feeBreakdown: [],
154-
nonce: 12345,
155-
cryptoLiquidityProvider: 'test-provider',
156-
notes: [],
157-
};
158-
15950
export const MOCK_DEPOSIT_ORDER: Partial<DepositOrder> = {
16051
id: 'test-order-id',
16152
provider: 'test-provider',
@@ -218,66 +109,6 @@ export const MOCK_BANK_DETAILS_ORDER = {
218109
},
219110
};
220111

221-
export const createMockSDKReturn = (overrides = {}): DepositSDK => ({
222-
sdkError: undefined,
223-
providerApiKey: null,
224-
isAuthenticated: false,
225-
authToken: undefined,
226-
setAuthToken: jest.fn().mockResolvedValue(true),
227-
logoutFromProvider: jest.fn().mockResolvedValue(undefined),
228-
checkExistingToken: jest.fn().mockResolvedValue(false),
229-
selectedWalletAddress: '0x1234567890123456789012345678901234567890',
230-
selectedRegion: MOCK_US_REGION,
231-
setSelectedRegion: jest.fn(),
232-
selectedPaymentMethod: MOCK_CREDIT_DEBIT_CARD,
233-
setSelectedPaymentMethod: jest.fn(),
234-
selectedCryptoCurrency: MOCK_USDC_TOKEN,
235-
setSelectedCryptoCurrency: jest.fn(),
236-
intent: undefined,
237-
setIntent: jest.fn(),
238-
...overrides,
239-
});
240-
241-
export const MOCK_USE_REGIONS_RETURN = {
242-
userRegionLocked: false,
243-
regions: MOCK_REGIONS,
244-
error: null,
245-
isFetching: false,
246-
retryFetchRegions: jest.fn(),
247-
};
248-
249-
export const MOCK_USE_CRYPTOCURRENCIES_RETURN = {
250-
cryptoCurrencies: MOCK_CRYPTOCURRENCIES,
251-
error: null,
252-
isFetching: false,
253-
retryFetchCryptoCurrencies: jest.fn(),
254-
};
255-
256-
export const MOCK_USE_PAYMENT_METHODS_RETURN = {
257-
paymentMethods: MOCK_PAYMENT_METHODS,
258-
error: null,
259-
isFetching: false,
260-
retryFetchPaymentMethods: jest.fn(),
261-
};
262-
263-
export const MOCK_USE_DEPOSIT_TOKEN_EXCHANGE_RETURN = {
264-
tokenAmount: '0.05',
265-
isLoadingTokenAmount: false,
266-
errorLoadingTokenAmount: null,
267-
};
268-
269-
export const MOCK_USE_ACCOUNT_TOKEN_COMPATIBLE_RETURN = {
270-
isAccountTokenCompatible: true,
271-
isLoadingAccountTokenCompatible: false,
272-
errorLoadingAccountTokenCompatible: null,
273-
};
274-
275-
export const MOCK_USE_DEPOSIT_SDK_METHOD_RETURN = {
276-
data: null,
277-
error: null as string | null,
278-
isFetching: false,
279-
};
280-
281112
export const MOCK_ANALYTICS_DEPOSIT_ORDER = {
282113
id: '123',
283114
provider: 'DEPOSIT',
@@ -305,140 +136,3 @@ export const MOCK_ANALYTICS_DEPOSIT_ORDER = {
305136
fiatCurrency: 'USD',
306137
},
307138
};
308-
309-
export const FIXED_DATE = new Date(2024, 0, 1);
310-
export const FIXED_TIMESTAMP = FIXED_DATE.getTime();
311-
312-
export const DEFAULT_WALLET_ADDRESS =
313-
'0x1234567890123456789012345678901234567890';
314-
export const TEST_QUOTE_ID = 'test-quote-id';
315-
export const TEST_ORDER_ID = 'test-order-id';
316-
export const TEST_PROVIDER = 'test-provider';
317-
318-
export const MOCK_USE_REGIONS_ERROR = {
319-
userRegionLocked: false,
320-
regions: null,
321-
error: 'Failed to fetch regions',
322-
isFetching: false,
323-
retryFetchRegions: jest.fn(),
324-
};
325-
326-
export const MOCK_USE_CRYPTOCURRENCIES_ERROR = {
327-
cryptoCurrencies: null,
328-
error: 'Failed to fetch cryptos',
329-
isFetching: false,
330-
retryFetchCryptoCurrencies: jest.fn(),
331-
};
332-
333-
export const MOCK_USE_PAYMENT_METHODS_ERROR = {
334-
paymentMethods: null,
335-
error: 'Failed to fetch payment methods',
336-
isFetching: false,
337-
retryFetchPaymentMethods: jest.fn(),
338-
};
339-
340-
export const MOCK_USE_REGIONS_LOADING = {
341-
userRegionLocked: false,
342-
regions: null,
343-
error: null,
344-
isFetching: true,
345-
retryFetchRegions: jest.fn(),
346-
};
347-
348-
export const MOCK_USE_CRYPTOCURRENCIES_LOADING = {
349-
cryptoCurrencies: null,
350-
error: null,
351-
isFetching: true,
352-
retryFetchCryptoCurrencies: jest.fn(),
353-
};
354-
355-
export const MOCK_USE_PAYMENT_METHODS_LOADING = {
356-
paymentMethods: null,
357-
error: null,
358-
isFetching: true,
359-
retryFetchPaymentMethods: jest.fn(),
360-
};
361-
362-
export const MOCK_USE_REGIONS_EMPTY = {
363-
userRegionLocked: false,
364-
regions: [],
365-
error: null,
366-
isFetching: false,
367-
retryFetchRegions: jest.fn(),
368-
};
369-
370-
export const MOCK_USE_CRYPTOCURRENCIES_EMPTY = {
371-
cryptoCurrencies: [],
372-
error: null,
373-
isFetching: false,
374-
retryFetchCryptoCurrencies: jest.fn(),
375-
};
376-
377-
export const MOCK_USE_PAYMENT_METHODS_EMPTY = {
378-
paymentMethods: [],
379-
error: null,
380-
isFetching: false,
381-
retryFetchPaymentMethods: jest.fn(),
382-
};
383-
384-
export const MOCK_USER_DETAILS_DEFAULT = {
385-
id: 'user-id',
386-
firstName: 'Test',
387-
lastName: 'User',
388-
email: 'test@example.com',
389-
mobileNumber: '1234567890',
390-
status: 'active',
391-
dob: '1990-01-01',
392-
kyc: {
393-
l1: {
394-
status: 'APPROVED',
395-
type: 'BASIC',
396-
updatedAt: '2023-01-01',
397-
kycSubmittedAt: '2023-01-01',
398-
},
399-
} as unknown as NativeTransakUserDetailsKycDetails,
400-
createdAt: '2023-01-01',
401-
isKycApproved: jest.fn().mockReturnValue(true),
402-
};
403-
404-
export const MOCK_USER_DETAILS_US = {
405-
...MOCK_USER_DETAILS_DEFAULT,
406-
id: 'user-id-us',
407-
address: {
408-
addressLine1: '123 Main St',
409-
addressLine2: '',
410-
state: 'CA',
411-
city: 'San Francisco',
412-
postCode: '94101',
413-
country: 'United States',
414-
countryCode: 'US',
415-
},
416-
} as NativeTransakUserDetails;
417-
418-
export const MOCK_USER_DETAILS_FR = {
419-
...MOCK_USER_DETAILS_DEFAULT,
420-
id: 'user-id-fr',
421-
address: {
422-
addressLine1: '123 Rue de la Paix',
423-
addressLine2: '',
424-
state: 'Île-de-France',
425-
city: 'Paris',
426-
postCode: '75001',
427-
country: 'France',
428-
countryCode: 'FR',
429-
},
430-
} as NativeTransakUserDetails;
431-
432-
export const MOCK_USE_DEPOSIT_USER_RETURN = {
433-
userDetails: null,
434-
error: null,
435-
isFetching: false,
436-
fetchUserDetails: jest.fn(),
437-
};
438-
439-
export const MOCK_USE_DEPOSIT_USER_ERROR = {
440-
userDetails: null,
441-
error: 'Failed to fetch user details',
442-
isFetching: false,
443-
fetchUserDetails: jest.fn(),
444-
};
Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1 @@
11
export * from './constants';
2-
3-
export const createMockHookReturn = <T>(
4-
defaultReturn: T,
5-
overrides: Partial<T> = {},
6-
): T => ({
7-
...defaultReturn,
8-
...overrides,
9-
});
10-
11-
export const createMockSDKMethods = () => ({
12-
mockGetQuote: jest.fn(),
13-
mockRouteAfterAuthentication: jest.fn(),
14-
mockNavigateToVerifyIdentity: jest.fn(),
15-
mockTrackEvent: jest.fn(),
16-
mockPostKycForm: jest.fn(),
17-
mockSubmitSsnDetails: jest.fn(),
18-
mockConfirmPayment: jest.fn(),
19-
mockCancelOrder: jest.fn(),
20-
});
21-
22-
export const createMockNavigation = () => ({
23-
mockNavigate: jest.fn(),
24-
mockGoBack: jest.fn(),
25-
mockSetNavigationOptions: jest.fn(),
26-
mockSetParams: jest.fn(),
27-
mockPop: jest.fn(),
28-
});

0 commit comments

Comments
 (0)