mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
test(vanilla/basic): add test for 'getInitialState' (#3130)
* test(vanilla/basic): add test for 'getInitialState' * Update tests/vanilla/basic.test.ts * Update tests/vanilla/basic.test.ts --------- Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
This commit is contained in:
parent
670b60e19a
commit
ad32cdf7a0
@ -70,6 +70,13 @@ it('can get the store', async () => {
|
||||
expect(store.getState().getState2().value).toBe(1)
|
||||
})
|
||||
|
||||
it('can get the initial state', () => {
|
||||
const initial = { value: 1 }
|
||||
const store = createStore(() => initial)
|
||||
store.setState({ value: 2 })
|
||||
expect(store.getInitialState()).toBe(initial)
|
||||
})
|
||||
|
||||
it('can set the store', async () => {
|
||||
type State = {
|
||||
value: number
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user