updux/dist/tutorial/initialState.test.js

23 lines
575 B
JavaScript

import { test, expect, expectTypeOf } from 'vitest';
/// --8<-- [start:tut1]
import Updux from 'updux';
const todosDux = new Updux({
initialState: {
nextId: 1,
todos: [],
},
});
/// ---8<-- [end:tut1]
test('basic', () => {
/// ---8<-- [start:tut2]
const store = todosDux.createStore();
const expected = {
nextId: 1,
todos: [],
};
expect(todosDux.initialState).toEqual(expected);
expect(store.getState()).toEqual(expected);
expectTypeOf(todosDux.initialState).toMatchTypeOf();
/// ---8<-- [end:tut2]
});