From 499e987219101a6e0d0c4a8e064eb2fbde5c92c3 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Fri, 3 Jan 2020 10:37:21 -0500 Subject: [PATCH] add the test --- src/selectors.test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/selectors.test.ts diff --git a/src/selectors.test.ts b/src/selectors.test.ts new file mode 100644 index 0000000..524e801 --- /dev/null +++ b/src/selectors.test.ts @@ -0,0 +1,27 @@ +import Updux from '.'; + +test('basic selectors', () => { + const updux = new Updux({ + subduxes: { + bogeys: { + selectors: { + bogey: (bogeys: any) => (id: string) => bogeys[id], + }, + }, + }, + selectors: { + bogeys: ({ bogeys }: any) => bogeys, + }, + } as any); + + const state = { + bogeys: { + foo: 1, + bar: 2 + } + }; + + expect( updux.selectors.bogeys(state) ).toEqual( { foo:1, bar :2 } ); + expect( updux.selectors.bogey(state)('foo')).toEqual(1); + +});