forked from SmartDropLabs/smartdrop-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlatformStats.test.tsx
More file actions
33 lines (29 loc) · 1.02 KB
/
Copy pathPlatformStats.test.tsx
File metadata and controls
33 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { describe, it, expect, vi } from 'vitest';
import { render } from '@testing-library/react';
import { PlatformStats } from './PlatformStats';
import * as hooks from '@/hooks/useSorobanQuery';
import { ChakraProvider } from '@chakra-ui/react';
vi.mock('@/hooks/useSorobanQuery', async (importOriginal) => {
const actual = await importOriginal<typeof import('@/hooks/useSorobanQuery')>();
return { ...actual, usePlatformStats: vi.fn() };
});
describe('<PlatformStats /> Layout Component', () => {
it('matches baseline style design snapshot tests', () => {
vi.spyOn(hooks, 'usePlatformStats').mockReturnValue({
data: {
tvl: '42300000000000',
activePools: 12,
totalFarmers: 15450,
creditVelocity: '8500000000000'
},
isLoading: false,
isError: false,
} as ReturnType<typeof hooks.usePlatformStats>);
const { asFragment } = render(
<ChakraProvider>
<PlatformStats />
</ChakraProvider>
);
expect(asFragment()).toMatchSnapshot();
});
});