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