Skip to content

Commit 62e8d9c

Browse files
committed
Fix unit tests & lint
1 parent 5d8c9ca commit 62e8d9c

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

app/components/Views/confirmations/hooks/useConfirmationRedesignEnabled.test.ts

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ const disabledFeatureFlags = {
2626
approve: false,
2727
};
2828

29-
jest.mock('../../../../util/address', () => ({
30-
...jest.requireActual('../../../../util/address'),
31-
isHardwareAccount: jest.fn(),
32-
isExternalHardwareAccount: jest.fn(),
33-
}));
34-
3529
jest.mock('../../../../core/Engine', () => ({
3630
getTotalEvmFiatAccountBalance: () => ({ tokenFiat: 10 }),
3731
context: {
@@ -53,11 +47,9 @@ describe('useConfirmationRedesignEnabled', () => {
5347
const confirmationRedesignFlagsMock = jest.mocked(
5448
selectConfirmationRedesignFlags,
5549
);
56-
const isHardwareAccountMock = jest.mocked(isHardwareAccount);
5750

5851
beforeEach(() => {
5952
jest.clearAllMocks();
60-
isHardwareAccountMock.mockReturnValue(false);
6153
confirmationRedesignFlagsMock.mockReturnValue(disabledFeatureFlags);
6254
});
6355

@@ -183,24 +175,6 @@ describe('useConfirmationRedesignEnabled', () => {
183175
expect(result.current.isRedesignedEnabled).toBe(false);
184176
});
185177

186-
it('returns true when from address is external hardware account', async () => {
187-
confirmationRedesignFlagsMock.mockReturnValue({
188-
...disabledFeatureFlags,
189-
signatures: true,
190-
staking_confirmations: true,
191-
});
192-
193-
isHardwareAccountMock.mockReturnValue(true);
194-
const { result } = renderHookWithProvider(
195-
useConfirmationRedesignEnabled,
196-
{
197-
state: stakingDepositConfirmationState,
198-
},
199-
);
200-
201-
expect(result.current.isRedesignedEnabled).toBe(true);
202-
});
203-
204178
it('only redesign if transactions is staking deposit', async () => {
205179
confirmationRedesignFlagsMock.mockReturnValue({
206180
...disabledFeatureFlags,
@@ -344,27 +318,6 @@ describe('useConfirmationRedesignEnabled', () => {
344318
);
345319
});
346320

347-
it('if confirmation is a transaction, validates `txParams.from` is hardware account', () => {
348-
isHardwareAccountMock.mockReturnValue(true);
349-
confirmationRedesignFlagsMock.mockReturnValue({
350-
...disabledFeatureFlags,
351-
transfer: true,
352-
});
353-
354-
const { result } = renderHookWithProvider(useConfirmationRedesignEnabled, {
355-
state: transferConfirmationState,
356-
});
357-
358-
const expectedFromAddress =
359-
transferConfirmationState.engine.backgroundState.TransactionController
360-
.transactions[0].txParams.from;
361-
362-
expect(isHardwareAccountMock).toHaveBeenCalledTimes(1);
363-
expect(isHardwareAccountMock).toHaveBeenCalledWith(expectedFromAddress);
364-
365-
expect(result.current.isRedesignedEnabled).toBe(false);
366-
});
367-
368321
it('returns false if transaction type is not in the list of redesigned transaction types', () => {
369322
const state = cloneDeep(approveERC20TransactionStateMock);
370323
state.engine.backgroundState.TransactionController.transactions[0].type =

app/components/Views/confirmations/hooks/useConfirmationRedesignEnabled.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ export const useConfirmationRedesignEnabled = () => {
9696
const confirmationRedesignFlags = useSelector(
9797
selectConfirmationRedesignFlags,
9898
);
99-
const fromAddress =
100-
transactionMetadata?.txParams?.from ?? approvalRequest?.requestData?.from;
10199

102100
const approvalRequestType = approvalRequest?.type as ApprovalType;
103101

@@ -116,7 +114,6 @@ export const useConfirmationRedesignEnabled = () => {
116114
[
117115
approvalRequestType,
118116
confirmationRedesignFlags,
119-
fromAddress,
120117
transactionMetadata,
121118
],
122119
);

0 commit comments

Comments
 (0)