add the test
This commit is contained in:
parent
27ae46dbab
commit
499e987219
27
src/selectors.test.ts
Normal file
27
src/selectors.test.ts
Normal 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);
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user