updux/src/createStore.test.js

19 lines
427 B
JavaScript
Raw Permalink Normal View History

2022-08-26 17:03:33 +00:00
import { test, expect } from 'vitest';
import { Updux } from './Updux.js';
2022-08-26 19:51:00 +00:00
test('basic createStore', async () => {
2022-08-26 17:03:33 +00:00
const foo = new Updux({
initial: { a: 1 },
2022-08-26 17:05:14 +00:00
actions: {
a1: null,
2022-08-26 19:51:00 +00:00
},
2022-08-26 17:03:33 +00:00
});
const store = foo.createStore();
2022-08-29 15:56:30 +00:00
expect(store.getState).toBeTypeOf('function');
2022-08-26 19:51:00 +00:00
expect(store.getState()).toEqual({ a: 1 });
2022-08-26 17:05:14 +00:00
expect(store.actions.a1).toBeTypeOf('function');
2022-08-26 17:03:33 +00:00
});