31 lines
877 B
JavaScript
31 lines
877 B
JavaScript
import { test, expect } from 'vitest';
|
|
import todoListDux from './todoList.js';
|
|
test('basic', () => {
|
|
const store = todoListDux.createStore();
|
|
store.dispatch.addTodo('write tutorial');
|
|
store.dispatch.addTodo('test code snippets');
|
|
store.dispatch.todoDone(2);
|
|
const s = store.getState();
|
|
expectTypeOf(s).toMatchTypeOf();
|
|
expect(store.getState()).toMatchObject({
|
|
todos: [
|
|
{ id: 1, done: false },
|
|
{ id: 2, done: true },
|
|
],
|
|
});
|
|
// expect(todoListDux.schema).toMatchObject({
|
|
// type: 'object',
|
|
// properties: {
|
|
// nextId: { type: 'number', default: 1 },
|
|
// todos: {
|
|
// default: [],
|
|
// type: 'array',
|
|
// }
|
|
// },
|
|
// default: {
|
|
// nextId: 1,
|
|
// todos: [],
|
|
// },
|
|
// });
|
|
});
|