add the test

This commit is contained in:
Yanick Champoux 2020-01-03 10:37:21 -05:00
parent 27ae46dbab
commit 499e987219

27
src/selectors.test.ts Normal file
View File

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