2022-08-09 13:25:47 +00:00
|
|
|
import { renderHook, act } from '@testing-library/react';
|
2022-08-09 10:10:55 +00:00
|
|
|
import useLocalValues from './use-local-values';
|
|
|
|
|
|
|
|
describe('local values hook', () => {
|
|
|
|
it('state of wallet dialog should be properly handled', () => {
|
2022-08-31 13:23:01 +00:00
|
|
|
const setTheme = jest.fn();
|
|
|
|
const { result } = renderHook(() => useLocalValues('light', setTheme));
|
2022-08-09 10:10:55 +00:00
|
|
|
expect(result.current.vegaWalletDialog).toBeDefined();
|
|
|
|
expect(result.current.vegaWalletDialog.manage).toBe(false);
|
|
|
|
expect(result.current.vegaWalletDialog.connect).toBe(false);
|
|
|
|
act(() => {
|
|
|
|
result.current.vegaWalletDialog.setConnect(true);
|
|
|
|
result.current.vegaWalletDialog.setManage(true);
|
|
|
|
});
|
|
|
|
expect(result.current.vegaWalletDialog.manage).toBe(true);
|
|
|
|
expect(result.current.vegaWalletDialog.connect).toBe(true);
|
|
|
|
});
|
|
|
|
});
|