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); + +});