From 430fec5af7c9f5a327b0b8da9ff2cbebbfed7221 Mon Sep 17 00:00:00 2001 From: He1DAr Date: Wed, 20 Sep 2023 10:40:23 -0400 Subject: [PATCH] fix: unit test --- .../BlockList/BlockAndMicroblocksItem.tsx | 2 +- .../components/BlockList/BlockListItem.tsx | 2 +- .../__tests__/BlocksListBase.test.tsx | 9 ++-- .../MicroblockListItem.test.tsx.snap | 10 ++--- src/app/components/BlockList/index.tsx | 5 ++- src/app/components/BlockList/types.ts | 2 +- .../__snapshots__/DesktopNav.test.tsx.snap | 10 ++--- .../__snapshots__/MobileNav.test.tsx.snap | 41 +++++++------------ src/app/txid/[txid]/TxDetails/BlockHeight.tsx | 4 +- .../TxDetails/__tests__/Broadcast.test.tsx | 4 +- .../__snapshots__/Broadcast.test.tsx.snap | 8 ++-- src/common/utils.spec.ts | 2 +- src/components/balances/stx-balance-card.tsx | 3 +- .../function-summary/function-summary.tsx | 2 +- src/components/modals/add-network.tsx | 4 +- src/components/modals/modal-slice.ts | 2 +- src/components/modals/unlocking-schedule.tsx | 4 +- src/features/blocks-visualizer/index.tsx | 2 +- .../search/items/block-result-item.tsx | 2 +- src/features/search/use-search.ts | 2 +- src/ui/theme/switchTheme.ts | 8 ++-- tsconfig.tsbuildinfo | 2 +- 22 files changed, 59 insertions(+), 71 deletions(-) diff --git a/src/app/components/BlockList/BlockAndMicroblocksItem.tsx b/src/app/components/BlockList/BlockAndMicroblocksItem.tsx index 77036072a..7e94c572a 100644 --- a/src/app/components/BlockList/BlockAndMicroblocksItem.tsx +++ b/src/app/components/BlockList/BlockAndMicroblocksItem.tsx @@ -7,7 +7,7 @@ import { useVerticallyStackedElementsBorderStyle } from '@/app/common/styles/bor import { MicroblockListItem } from './MicroblockListItem'; import { Text } from '@/ui/Text'; import React, { memo } from 'react'; -import { Block } from '@stacks/blockchain-api-client'; +import { Block } from '@stacks/stacks-blockchain-api-types'; import { BlockListItem } from './BlockListItem'; export const BlockAndMicroblocksItem: React.FC<{ block: Block }> = memo( diff --git a/src/app/components/BlockList/BlockListItem.tsx b/src/app/components/BlockList/BlockListItem.tsx index d833f8851..06ec02b81 100644 --- a/src/app/components/BlockList/BlockListItem.tsx +++ b/src/app/components/BlockList/BlockListItem.tsx @@ -8,7 +8,7 @@ import { Caption, Text } from '@/ui/typography'; import pluralize from 'pluralize'; import React from 'react'; -import { Block } from '@stacks/blockchain-api-client'; +import { Block } from '@stacks/stacks-blockchain-api-types'; export const BlockListItem: React.FC<{ block: Block } & FlexProps> = React.memo( ({ block, ...rest }) => { diff --git a/src/app/components/BlockList/__tests__/BlocksListBase.test.tsx b/src/app/components/BlockList/__tests__/BlocksListBase.test.tsx index aa4bc1234..fcfc41d21 100644 --- a/src/app/components/BlockList/__tests__/BlocksListBase.test.tsx +++ b/src/app/components/BlockList/__tests__/BlocksListBase.test.tsx @@ -2,11 +2,10 @@ import React from 'react'; import { render, screen, fireEvent, waitFor, act } from '@testing-library/react'; import BlocksListBase from '../'; import { useBlockListInfinite as useBlockListInfiniteActual } from '@/app/common/queries/useBlockListInfinite'; -import { - Block, - connectWebSocketClient as connectWebSocketClientActual, - StacksApiWebSocketClient, -} from '@stacks/blockchain-api-client'; +import { connectWebSocketClient as connectWebSocketClientActual } from '@stacks/blockchain-api-client'; +import { Block } from '@stacks/stacks-blockchain-api-types'; +import { StacksApiWebSocketClient } from '@stacks/blockchain-api-client'; + import { EnhancedBlock } from '@/app/components/BlockList/types'; const useBlockListInfinite = useBlockListInfiniteActual as jest.MockedFunction< diff --git a/src/app/components/BlockList/__tests__/__snapshots__/MicroblockListItem.test.tsx.snap b/src/app/components/BlockList/__tests__/__snapshots__/MicroblockListItem.test.tsx.snap index b95cdda28..df2e6590e 100644 --- a/src/app/components/BlockList/__tests__/__snapshots__/MicroblockListItem.test.tsx.snap +++ b/src/app/components/BlockList/__tests__/__snapshots__/MicroblockListItem.test.tsx.snap @@ -3,10 +3,10 @@ exports[`MicroblockListItem component renders correctly 1`] = `
{ const client = await connectWebSocketClient(activeNetwork.url.replace('https://', 'wss://')); - sub = await client.subscribeBlocks(block => { + sub = await client.subscribeBlocks((block: any) => { setLatestBlocks(prevLatestBlocks => [ { ...block, microblock_tx_count: {}, animate: true }, ...prevLatestBlocks, diff --git a/src/app/components/BlockList/types.ts b/src/app/components/BlockList/types.ts index 12882fa78..563ec6a8f 100644 --- a/src/app/components/BlockList/types.ts +++ b/src/app/components/BlockList/types.ts @@ -1,3 +1,3 @@ -import { Block } from '@stacks/blockchain-api-client'; +import { Block } from '@stacks/stacks-blockchain-api-types'; export type EnhancedBlock = Block & { destroy?: boolean; animate?: boolean }; diff --git a/src/app/components/NavBar/__tests__/__snapshots__/DesktopNav.test.tsx.snap b/src/app/components/NavBar/__tests__/__snapshots__/DesktopNav.test.tsx.snap index 039b1c0b0..4edf505e7 100644 --- a/src/app/components/NavBar/__tests__/__snapshots__/DesktopNav.test.tsx.snap +++ b/src/app/components/NavBar/__tests__/__snapshots__/DesktopNav.test.tsx.snap @@ -3,16 +3,16 @@ exports[`DesktopNav should render correctly 1`] = `