Skip to content

Commit

Permalink
fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAlec committed Aug 29, 2024
1 parent 1ee8544 commit 6220921
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
32 changes: 16 additions & 16 deletions src/swap/hooks/useFromTo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,42 @@ describe('useFromTo', () => {
(useSwapBalances as vi.Mock).mockReturnValue({
fromBalanceString: '100',
fromTokenBalanceError: null,
fromTokenResponse: { refetch: vi.fn() },
toBalanceString: '200',
toTokenBalanceError: null,
fromTokenResponse: { refetch: vi.fn() },
toTokenResponse: { refetch: vi.fn() },
});
(useValue as vi.Mock).mockImplementation((props) => ({
...props,
amount: '100',
response: props.response,
setAmount: vi.fn(),
token: USDC_TOKEN,
setToken: vi.fn(),
setLoading: vi.fn(),
response: props.response,
setToken: vi.fn(),
token: USDC_TOKEN,
}));
const { result } = renderHook(() => useFromTo('0x123'));
expect(result.current.from).toEqual({
balance: '100',
amount: '100',
setAmount: expect.any(Function),
token: USDC_TOKEN,
setToken: expect.any(Function),
loading: false,
setLoading: expect.any(Function),
balance: '100',
error: null,
loading: false,
response: { refetch: expect.any(Function) },
setAmount: expect.any(Function),
setLoading: expect.any(Function),
setToken: expect.any(Function),
token: USDC_TOKEN,
});
expect(result.current.to).toEqual({
balance: '200',
amount: '100',
setAmount: expect.any(Function),
token: USDC_TOKEN,
setToken: expect.any(Function),
loading: false,
setLoading: expect.any(Function),
balance: '200',
error: null,
loading: false,
response: { refetch: expect.any(Function) },
setAmount: expect.any(Function),
setLoading: expect.any(Function),
setToken: expect.any(Function),
token: USDC_TOKEN,
});
});

Expand Down
3 changes: 1 addition & 2 deletions src/swap/hooks/useSwapBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ export function useSwapBalances({
return useValue({
fromBalanceString,
fromTokenBalanceError,
fromTokenResponse,

toBalanceString,
toTokenBalanceError,

fromTokenResponse,
toTokenResponse,
});
}
2 changes: 1 addition & 1 deletion src/swap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export type SwapUnit = {
balance?: string;
error?: SwapError;
loading: boolean;
response: UseBalanceReturnType | UseReadContractReturnType | undefined;
response?: UseBalanceReturnType | UseReadContractReturnType;
setAmount: Dispatch<SetStateAction<string>>;
setLoading: Dispatch<SetStateAction<boolean>>;
setToken: Dispatch<SetStateAction<Token | undefined>>;
Expand Down

0 comments on commit 6220921

Please sign in to comment.