Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Jan 21, 2024
1 parent b3c8b15 commit 97ff407
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/basic.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -680,3 +680,20 @@ it('works with non-object state', async () => {
fireEvent.click(getByText('button'))
await findByText('count: 2')
})

it('works with "undefined" state', async () => {
const useUndefined = create(() => undefined)

const Component = () => {
const str = useUndefined((v) => v || 'undefined')
return <div>str: {str}</div>
}

const { findByText } = render(
<StrictMode>
<Component />
</StrictMode>,
)

await findByText('str: undefined')
})

0 comments on commit 97ff407

Please sign in to comment.