diff --git a/src/SDKVersion.tsx b/src/SDKVersion.tsx index ce7d557..5ee234b 100644 --- a/src/SDKVersion.tsx +++ b/src/SDKVersion.tsx @@ -1,7 +1,7 @@ import { InfoOutlineIcon } from '@chakra-ui/icons'; import { Tooltip, VStack, Text, Flex } from '@chakra-ui/react'; -import { workerClientBus } from './decrypt-worker/client.ts'; -import { DECRYPTION_WORKER_ACTION_NAME } from './decrypt-worker/constants'; +import { workerClientBus } from '~/decrypt-worker/client'; +import { DECRYPTION_WORKER_ACTION_NAME } from '~/decrypt-worker/constants'; import usePromise from 'react-promise-suspense'; @@ -11,8 +11,9 @@ const getSDKVersion = async (): Promise => { export function SDKVersion() { const sdkVersion = usePromise(getSDKVersion, []); + return ( - + { +vi.mock('../decrypt-worker/client', () => { + return { + workerClientBus: { + request: vi.fn().mockResolvedValue('dummy'), + }, + }; +}); + +test('should be able to render App', async () => { renderWithProviders(); + // Should eventually load sdk version + await waitFor(() => screen.getByTestId('sdk-version')); + // Quick sanity check of known strings. expect(screen.getByText(/仅在浏览器内对文件进行解锁/i)).toBeInTheDocument(); expect(screen.getByText(/UnlockMusic 团队/i)).toBeInTheDocument();