) => {
const { isMobile } = useDevice();
const { subscribeRates } = useExchangeRates();
@@ -133,7 +133,8 @@ const MyAdsTableRow = ({ currentRateType, showModal, ...rest }: TMyAdsTableProps
- {`${FormatUtils.formatMoney(amountDealt, { currency: accountCurrency })}`} {accountCurrency}
+ {`${FormatUtils.formatMoney(amountDealt, { currency: accountCurrency as TCurrency })}`}{' '}
+ {accountCurrency}
{advertType === 'Buy' ? 'Bought' : 'Sold'}
diff --git a/src/pages/my-ads/screens/MyAds/MyAdsTableRow/__tests__/MyAdsTableRowView.spec.tsx b/src/pages/my-ads/screens/MyAds/MyAdsTableRow/__tests__/MyAdsTableRowView.spec.tsx
index 7ee97310..d271d4d8 100644
--- a/src/pages/my-ads/screens/MyAds/MyAdsTableRow/__tests__/MyAdsTableRowView.spec.tsx
+++ b/src/pages/my-ads/screens/MyAds/MyAdsTableRow/__tests__/MyAdsTableRowView.spec.tsx
@@ -56,6 +56,10 @@ const mockProps = {
min_rating: 4,
order_expiry_period: 900,
payment_info: '',
+ is_floating: false,
+ balanceAvailable: 0,
+ dailyBuyLimit: '',
+ dailySellLimit: '',
};
const mockHistory = {
push: jest.fn(),
diff --git a/src/pages/orders/screens/OrderDetails/OrderDetails.tsx b/src/pages/orders/screens/OrderDetails/OrderDetails.tsx
index c3b9151c..6c6d0e1e 100644
--- a/src/pages/orders/screens/OrderDetails/OrderDetails.tsx
+++ b/src/pages/orders/screens/OrderDetails/OrderDetails.tsx
@@ -3,6 +3,7 @@ import { useHistory, useLocation, useParams } from 'react-router-dom';
import { FullPageMobileWrapper, PageReturn } from '@/components';
import { api } from '@/hooks';
import { useExtendedOrderDetails } from '@/hooks/custom-hooks';
+import { ExtendedOrderDetails } from '@/hooks/custom-hooks/useExtendedOrderDetails';
import { OrderDetailsProvider } from '@/providers/OrderDetailsProvider';
import { useAuthData } from '@deriv-com/api-hooks';
import { Button, InlineMessage, Loader, Text, useDevice } from '@deriv-com/ui';
@@ -25,7 +26,7 @@ const OrderDetails = () => {
const { data: serverTime } = api.account.useServerTime();
const { data: orderDetails } = useExtendedOrderDetails({
loginId: activeAccount?.loginid,
- orderDetails: orderInfo,
+ orderDetails: orderInfo as ExtendedOrderDetails,
serverTime,
});
const { isBuyOrderForUser, shouldShowLostFundsBanner } = orderDetails;
diff --git a/src/pages/orders/screens/OrderDetails/__tests__/OrderDetails.spec.tsx b/src/pages/orders/screens/OrderDetails/__tests__/OrderDetails.spec.tsx
index e67c8c22..f405998c 100644
--- a/src/pages/orders/screens/OrderDetails/__tests__/OrderDetails.spec.tsx
+++ b/src/pages/orders/screens/OrderDetails/__tests__/OrderDetails.spec.tsx
@@ -98,7 +98,7 @@ describe('', () => {
isLoading: false,
});
- render();
+ render();
expect(screen.getByTestId('dt_derivs-loader')).toBeInTheDocument();
});
diff --git a/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.tsx b/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.tsx
index d3181f4c..f0c61a5e 100644
--- a/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.tsx
+++ b/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.tsx
@@ -1,16 +1,17 @@
import clsx from 'clsx';
import { useHistory } from 'react-router-dom';
-import { THooks } from 'types';
+import { DeepPartial, THooks } from 'types';
import { ORDERS_STATUS, ORDERS_URL } from '@/constants';
import { api } from '@/hooks';
import { useExtendedOrderDetails, useQueryString } from '@/hooks/custom-hooks';
+import { ExtendedOrderDetails } from '@/hooks/custom-hooks/useExtendedOrderDetails';
import { OrderRatingButton, OrderStatusTag, OrderTimer } from '@/pages/orders/components';
import { getDistanceToServerTime } from '@/utils';
import { Button, Text, useDevice } from '@deriv-com/ui';
import ChatIcon from '../../../../../public/ic-chat.svg';
import './OrdersTableRow.scss';
-const OrdersTableRow = ({ ...props }: THooks.Order.GetList[number]) => {
+const OrdersTableRow = ({ ...props }: DeepPartial) => {
const { isMobile } = useDevice();
const { queryString } = useQueryString();
const history = useHistory();
@@ -19,7 +20,7 @@ const OrdersTableRow = ({ ...props }: THooks.Order.GetList[number]) => {
const { data: serverTime } = api.account.useServerTime();
const { data: orderDetails } = useExtendedOrderDetails({
loginId: activeAccount?.loginid,
- orderDetails: props,
+ orderDetails: props as ExtendedOrderDetails,
serverTime,
});
diff --git a/src/pages/orders/screens/Orders/OrdersTableRow/__tests__/OrderTableRow.spec.tsx b/src/pages/orders/screens/Orders/OrdersTableRow/__tests__/OrderTableRow.spec.tsx
index 99a3c7b9..91714ec4 100644
--- a/src/pages/orders/screens/Orders/OrdersTableRow/__tests__/OrderTableRow.spec.tsx
+++ b/src/pages/orders/screens/Orders/OrdersTableRow/__tests__/OrderTableRow.spec.tsx
@@ -1,3 +1,4 @@
+import { THooks } from 'types';
import { useDevice } from '@deriv-com/ui';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
@@ -32,16 +33,18 @@ const mockUseDevice = useDevice as jest.Mock;
const mockProps = {
account_currency: 'USD',
advert_details: {
- block_trade: 0,
+ is_block_trade: false,
+ block_trade: 0 as THooks.Order.GetList[number]['advert_details']['block_trade'],
description: 'Created by script. Please call me 02203400',
id: '116',
payment_method: 'bank_transfer',
- type: 'sell',
+ type: 'sell' as 'buy' | 'sell',
},
advertiser_details: {
first_name: 'QA script',
id: '59',
- is_online: 1,
+ is_online: true,
+ is_recommended: undefined,
last_name: 'userPlOta',
last_online_time: 1709818078,
loginid: 'CR90000299',
@@ -78,7 +81,10 @@ const mockProps = {
rate: 13500,
rate_display: '13500.00',
status: 'completed',
- type: 'buy',
+ type: 'buy' as 'buy' | 'sell',
+ is_seen: false,
+ review_details: undefined,
+ is_verification_pending: false,
};
describe('OrdersTableRow', () => {
it('should render the component', () => {
diff --git a/src/providers/OrderDetailsProvider/OrderDetailsProvider.tsx b/src/providers/OrderDetailsProvider/OrderDetailsProvider.tsx
index 4536b724..d5eae646 100644
--- a/src/providers/OrderDetailsProvider/OrderDetailsProvider.tsx
+++ b/src/providers/OrderDetailsProvider/OrderDetailsProvider.tsx
@@ -1,7 +1,7 @@
import { createContext, PropsWithChildren, useContext } from 'react';
import { useExtendedOrderDetails } from '@/hooks/custom-hooks';
-type TOrderDetails = ReturnType['data'];
+export type TOrderDetails = ReturnType['data'];
type TContextValue = {
isErrorOrderInfo: boolean;
diff --git a/src/providers/OrderDetailsProvider/__tests__/OrderDetailsProvider.spec.tsx b/src/providers/OrderDetailsProvider/__tests__/OrderDetailsProvider.spec.tsx
index 6fea9d00..37008c5e 100644
--- a/src/providers/OrderDetailsProvider/__tests__/OrderDetailsProvider.spec.tsx
+++ b/src/providers/OrderDetailsProvider/__tests__/OrderDetailsProvider.spec.tsx
@@ -1,11 +1,13 @@
+import { ReactNode } from 'react';
+import { ExtendedOrderDetails } from '@/hooks/custom-hooks/useExtendedOrderDetails';
import { renderHook } from '@testing-library/react';
import { OrderDetailsProvider, useOrderDetails } from '../OrderDetailsProvider';
describe('useOrderDetails', () => {
it('should return the orderDetails from context', () => {
- const mockValues = { isErrorOrderInfo: false, orderDetails: 'mockOrderDetails' };
+ const mockValues = { isErrorOrderInfo: false, orderDetails: { isActiveOrder: true } as ExtendedOrderDetails };
- const wrapper = ({ children }: { children: JSX.Element }) => (
+ const wrapper = ({ children }: { children: ReactNode }) => (
{children}
);