updux/docs/tutorial.test.js

27 lines
508 B
JavaScript

import { test, expect } from 'vitest';
import { Updux } from '../src/index.js';
test( "basic checks", async () => {
const todosDux = new Updux({
initial: {
next_id: 1,
todos: [],
},
actions: {
addTodo: null,
todoDone: null,
}
});
const store = todosDux.createStore();
expect(store.getState()).toEqual({ next_id: 1, todos: [] });
expect(store.actions.addTodo("learn updux")).toMatchObject({
type: 'addTodo', payload: 'learn updux'
})
});