From 0e894b7db1648969043b2371dec2aa01a0da8f2c Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Mon, 20 Mar 2023 10:25:31 -0400 Subject: [PATCH] remove obsolete todos --- src/createStore.test.todo | 18 ------------------ src/reactions.test.todo | 30 ------------------------------ src/utils.todo | 6 ------ 3 files changed, 54 deletions(-) delete mode 100644 src/createStore.test.todo delete mode 100644 src/reactions.test.todo delete mode 100644 src/utils.todo diff --git a/src/createStore.test.todo b/src/createStore.test.todo deleted file mode 100644 index 286de5e..0000000 --- a/src/createStore.test.todo +++ /dev/null @@ -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'); -}); diff --git a/src/reactions.test.todo b/src/reactions.test.todo deleted file mode 100644 index 8f006f8..0000000 --- a/src/reactions.test.todo +++ /dev/null @@ -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 -}); diff --git a/src/utils.todo b/src/utils.todo deleted file mode 100644 index 956a5ff..0000000 --- a/src/utils.todo +++ /dev/null @@ -1,6 +0,0 @@ -export const matches = (conditions) => (target) => - Object.entries(conditions).every(([key, value]) => - typeof value === 'function' - ? value(target[key]) - : target[key] === value, - );