diff --git a/src/components/PaymentMethodCard/__tests__/PaymentMethodCard.spec.tsx b/src/components/PaymentMethodCard/__tests__/PaymentMethodCard.spec.tsx index 95988768..cee78b78 100644 --- a/src/components/PaymentMethodCard/__tests__/PaymentMethodCard.spec.tsx +++ b/src/components/PaymentMethodCard/__tests__/PaymentMethodCard.spec.tsx @@ -23,6 +23,11 @@ const mockProps = { shouldShowPaymentMethodDisplayName: false, }; +jest.mock('@deriv-com/ui', () => ({ + ...jest.requireActual('@deriv-com/ui'), + useDevice: jest.fn(() => ({ isMobile: false })), +})); + describe('PaymentMethodCard', () => { it('should render the component correctly', () => { render(); diff --git a/src/components/PaymentMethodCard/__tests__/PaymentMethodCardBody.spec.tsx b/src/components/PaymentMethodCard/__tests__/PaymentMethodCardBody.spec.tsx index 9800a42c..d5947fbf 100644 --- a/src/components/PaymentMethodCard/__tests__/PaymentMethodCardBody.spec.tsx +++ b/src/components/PaymentMethodCard/__tests__/PaymentMethodCardBody.spec.tsx @@ -3,9 +3,7 @@ import { PaymentMethodCardBody } from '../PaymentMethodCardBody'; jest.mock('@deriv-com/ui', () => ({ ...jest.requireActual('@deriv-com/ui'), - useDevice: jest.fn(() => { - false; - }), + useDevice: jest.fn(() => ({ isMobile: false })), })); describe('PaymentMethodCardBody', () => { diff --git a/src/pages/my-profile/screens/PaymentMethods/PaymentMethodsList/__test__/PaymentMethodsListContent.spec.tsx b/src/pages/my-profile/screens/PaymentMethods/PaymentMethodsList/__test__/PaymentMethodsListContent.spec.tsx index 0be8978f..7f82a039 100644 --- a/src/pages/my-profile/screens/PaymentMethods/PaymentMethodsList/__test__/PaymentMethodsListContent.spec.tsx +++ b/src/pages/my-profile/screens/PaymentMethods/PaymentMethodsList/__test__/PaymentMethodsListContent.spec.tsx @@ -6,15 +6,6 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { PaymentMethodsListContent } from '../PaymentMethodsListContent'; -jest.mock('@/hooks', () => ({ - ...jest.requireActual('@/hooks'), - api: { - advertiserPaymentMethods: { - useDelete: jest.fn(), - }, - }, -})); - const mockPaymentMethodsData: THooks.AdvertiserPaymentMethods.Get = [ { display_name: 'Other', @@ -72,6 +63,15 @@ const mockUseDeleteResponse: ReturnType ({ + ...jest.requireActual('@/hooks'), + api: { + advertiserPaymentMethods: { + useDelete: jest.fn(() => mockUseDeleteResponse), + }, + }, +})); + jest.mock('@/components/Modals', () => ({ ...jest.requireActual('@/components/Modals'), PaymentMethodErrorModal: jest.fn(({ isModalOpen, onConfirm }: ComponentProps) => { @@ -99,6 +99,11 @@ jest.mock('@/components/Modals', () => ({ }), })); +jest.mock('@deriv-com/ui', () => ({ + ...jest.requireActual('@deriv-com/ui'), + useDevice: jest.fn().mockReturnValue({ isMobile: false }), +})); + const mockUseDelete = api.advertiserPaymentMethods.useDelete as jest.MockedFunction< typeof api.advertiserPaymentMethods.useDelete >;