Skip to content

Commit

Permalink
test: fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alfetopito committed Feb 20, 2024
1 parent 18be95f commit 3df0c9e
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useSafeBundleFlowContext } from 'modules/limitOrders/hooks/useSafeBundl
import { safeBundleFlow } from 'modules/limitOrders/services/safeBundleFlow'
import { tradeFlow } from 'modules/limitOrders/services/tradeFlow'
import { TradeFlowContext } from 'modules/limitOrders/services/types'
import { useNavigateToOpenOrdersTable } from 'modules/ordersTable'

import { useNeedsApproval } from 'common/hooks/useNeedsApproval'
import { TradeAmounts } from 'common/types'
Expand All @@ -21,6 +22,7 @@ import { defaultLimitOrdersSettings } from '../state/limitOrdersSettingsAtom'

jest.mock('modules/limitOrders/services/tradeFlow')
jest.mock('modules/limitOrders/services/safeBundleFlow')
jest.mock('modules/ordersTable')

jest.mock('modules/limitOrders/hooks/useSafeBundleFlowContext')
jest.mock('common/hooks/useNeedsApproval')
Expand All @@ -44,6 +46,9 @@ jest.mock('common/hooks/useAnalyticsReporter')

const mockTradeFlow = tradeFlow as jest.MockedFunction<typeof tradeFlow>
const mockSafeBundleFlow = safeBundleFlow as jest.MockedFunction<typeof safeBundleFlow>
const mockUseNavigateToOpenOrdersTable = useNavigateToOpenOrdersTable as jest.MockedFunction<
typeof useNavigateToOpenOrdersTable
>

const mockUseSafeBundleFlowContext = useSafeBundleFlowContext as jest.MockedFunction<typeof useSafeBundleFlowContext>
const mockUseNeedsApproval = useNeedsApproval as jest.MockedFunction<typeof useNeedsApproval>
Expand Down Expand Up @@ -83,6 +88,7 @@ describe('useHandleOrderPlacement', () => {
mockUseSafeBundleFlowContext.mockImplementation(() => null)
mockUseNeedsApproval.mockImplementation(() => false)
mockIsBundlingSupported.mockImplementation(() => true)
mockUseNavigateToOpenOrdersTable.mockImplementation(() => () => {})
})

it('When a limit order placed, then the recipient value should be deleted', async () => {
Expand Down

0 comments on commit 3df0c9e

Please sign in to comment.