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:
Wonsuk Choi 2025-05-21 20:22:09 +09:00 committed by GitHub
parent 670b60e19a
commit ad32cdf7a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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