remove obsolete todos

This commit is contained in:
Yanick Champoux 2023-03-20 10:25:31 -04:00
parent 56625c5083
commit 0e894b7db1
3 changed files with 0 additions and 54 deletions

View File

@ -1,18 +0,0 @@
import { test, expect } from 'vitest';
import { Updux } from './Updux.js';
test('basic createStore', async () => {
const foo = new Updux({
initial: { a: 1 },
actions: {
a1: null,
},
});
const store = foo.createStore();
expect(store.getState).toBeTypeOf('function');
expect(store.getState()).toEqual({ a: 1 });
expect(store.actions.a1).toBeTypeOf('function');
});

View File

@ -1,30 +0,0 @@
import { test, expect, vi } from 'vitest';
import { Updux } from './Updux.js';
test('subduxes reactions', async () => {
const spyA = vi.fn();
const spyB = vi.fn();
const foo = new Updux({
subduxes: {
a: new Updux({
initial: 1,
reactions: [() => (state) => spyA(state)],
actions: { inc: null },
mutations: {
inc: () => (state) => state + 1,
},
}),
b: new Updux({ initial: 10, reactions: [() => spyB] }),
},
});
const store = foo.createStore();
store.dispatch.inc();
store.dispatch.inc();
expect(spyA).toHaveBeenCalledTimes(2);
expect(spyA).toHaveBeenCalledWith(3);
expect(spyB).toHaveBeenCalledOnce(); // the original inc initialized the state
});

View File

@ -1,6 +0,0 @@
export const matches = (conditions) => (target) =>
Object.entries(conditions).every(([key, value]) =>
typeof value === 'function'
? value(target[key])
: target[key] === value,
);