add the test

typescript
Yanick Champoux 2020-01-03 10:37:21 -05:00
parent 27ae46dbab
commit 499e987219
1 changed files with 27 additions and 0 deletions

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