From 0870767994e0e33df6c050371892a0992e92aee9 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Wed, 29 Sep 2021 09:40:02 -0400 Subject: [PATCH] wip --- src/Updux.js | 8 ++++++++ src/Updux.test.js | 13 ++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Updux.js b/src/Updux.js index c738054..d9dc51d 100644 --- a/src/Updux.js +++ b/src/Updux.js @@ -37,6 +37,10 @@ export class Updux { return this.#memoActions(this.#actions, this.#subduxes); } + get selectors() { + return {}; + } + addAction(type, payloadFunc) { const theAction = action(type,payloadFunc); @@ -44,4 +48,8 @@ export class Updux { return theAction; } + + addSelector(name, func) { + return; + } } diff --git a/src/Updux.test.js b/src/Updux.test.js index 034f52a..1445261 100644 --- a/src/Updux.test.js +++ b/src/Updux.test.js @@ -59,7 +59,10 @@ test('addAction', async(t) => { test('basic selectors', async(t) => { const alpha = new Updux({ initial: { quux: 3 }, - }).addSelector('getQuux', ({ quux }) => quux); + selectors: { + getQuux: ({quux}) => quux + } + }); const dux = new Updux({ initial: { @@ -70,10 +73,10 @@ test('basic selectors', async(t) => { selectors: { getBar: ({ bar }) => bar, }, - }) - .addSelector('getFoo', (state) => state.foo) - .addSelector('getAdd', ({ foo }) => (add) => add + foo) - .addAction('stuff'); + }); + dux.addSelector('getFoo', (state) => state.foo) + dux.addSelector('getAdd', ({ foo }) => (add) => add + foo) + dux.addAction('stuff'); t.equal(dux.selectors.getBar({ bar: 3 }), 3); t.equal(dux.selectors.getFoo({ foo: 3 }) , 3);