Skip to content

Commit

Permalink
chore(tests): remove imperfectly working test added in #276 (#1184)
Browse files Browse the repository at this point in the history
* used createRoot in test

* Removed unused test
  • Loading branch information
lucasrabiec authored Aug 17, 2022
1 parent af607ed commit 75d0886
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions tests/basic.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useLayoutEffect,
useState,
} from 'react'
import { act, fireEvent, render, waitFor } from '@testing-library/react'
import { act, fireEvent, render } from '@testing-library/react'
import ReactDOM from 'react-dom'
import create, { StoreApi } from 'zustand'

Expand Down Expand Up @@ -143,25 +143,6 @@ it('only re-renders if selected state has changed', async () => {
expect(controlRenderCount).toBe(1)
})

it('re-renders with useLayoutEffect', async () => {
const useBoundStore = create(() => ({ state: false }))

function Component() {
const { state } = useBoundStore()
useLayoutEffect(() => {
useBoundStore.setState({ state: true })
}, [])
return <>{`${state}`}</>
}

const container = document.createElement('div')
ReactDOM.render(<Component />, container)
await waitFor(() => {
expect(container.innerHTML).toBe('true')
})
ReactDOM.unmountComponentAtNode(container)
})

it('can batch updates', async () => {
const useBoundStore = create<CounterState>((set) => ({
count: 0,
Expand Down

0 comments on commit 75d0886

Please sign in to comment.