import type { MutableRefObject } from 'react' import React, { useImperativeHandle } from 'react' import { useGrid } from './use-grid' import { render } from '@testing-library/react' type UseGrid = ReturnType const Test = ({ gridRef }: { gridRef: MutableRefObject }) => { const grid = useGrid() useImperativeHandle(gridRef, () => grid) return
} describe('useGrid hook', () => { it('should create store', () => { const gridRef = React.createRef() render(} />) expect(gridRef.current).toHaveProperty('subscribe') expect(gridRef.current).toHaveProperty('dispatch') expect(gridRef.current).toHaveProperty('getState') }) it('should create events', () => { const gridRef = React.createRef() render(} />) expect(gridRef.current).toHaveProperty('events') }) it('should create api', () => { const gridRef = React.createRef() render(} />) expect(gridRef.current).toHaveProperty('api') }) })