From 6a7e34481cb1636f04a234f30044528e0755590d Mon Sep 17 00:00:00 2001 From: Nada Date: Mon, 13 May 2024 12:14:46 +0400 Subject: [PATCH] fix: build fail issue fixed --- src/pages/my-ads/components/AdTypeSection/AdTypeSection.tsx | 4 +++- .../components/AdTypeSection/__tests__/AdTypeSection.spec.tsx | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/my-ads/components/AdTypeSection/AdTypeSection.tsx b/src/pages/my-ads/components/AdTypeSection/AdTypeSection.tsx index f6af0f6b..5fe38aab 100644 --- a/src/pages/my-ads/components/AdTypeSection/AdTypeSection.tsx +++ b/src/pages/my-ads/components/AdTypeSection/AdTypeSection.tsx @@ -5,6 +5,7 @@ import { FloatingRate, RadioGroup } from '@/components'; import { BUY_SELL, RATE_TYPE } from '@/constants'; import { useQueryString } from '@/hooks/custom-hooks'; import { getValidationRules, restrictDecimalPlace } from '@/utils'; +import { useTranslations } from '@deriv-com/translations'; import { Text, useDevice } from '@deriv-com/ui'; import { AdFormController } from '../AdFormController'; import { AdFormInput } from '../AdFormInput'; @@ -24,6 +25,7 @@ type TAdTypeSectionProps = { const AdTypeSection = ({ currency, localCurrency, onCancel, rateType, ...props }: TAdTypeSectionProps) => { const { queryString } = useQueryString(); + const { localize } = useTranslations(); const { advertId = '' } = queryString; const isEdit = !!advertId; const { isMobile } = useDevice(); @@ -120,7 +122,7 @@ const AdTypeSection = ({ currency, localCurrency, onCancel, rateType, ...props } /> ); }} - rules={{ validate: getValidationRules('rate-value', getValues) }} + rules={{ validate: getValidationRules('rate-value', getValues, localize) }} /> ) : ( ({ AdFormTextArea: () =>
AdFormTextArea
, })); +jest.mock('@deriv-com/translations', () => ({ + ...jest.requireActual('@deriv-com/translations'), + useTranslations: () => ({ localize: jest.fn() }), +})); const mockSetFieldValue = jest.fn(); const mockTriggerFunction = jest.fn(); jest.mock('react-hook-form', () => ({