22 lines
652 B
JavaScript
22 lines
652 B
JavaScript
import { test, expect } from 'vitest';
|
|
import { expectTypeOf } from 'expect-type';
|
|
import Updux from './Updux.js';
|
|
const subA = new Updux({
|
|
initialState: true,
|
|
actions: {
|
|
action1: (x) => x,
|
|
},
|
|
selectors: {
|
|
getAntiSub: (s) => !s,
|
|
},
|
|
});
|
|
const mainDux = new Updux({
|
|
subduxes: { subA },
|
|
});
|
|
test('subduxes resolves as objects', () => {
|
|
expectTypeOf(mainDux.initialState).toMatchTypeOf();
|
|
expectTypeOf(mainDux.actions.action1('foo')).toMatchTypeOf();
|
|
expectTypeOf(mainDux.selectors.getAntiSub({ subA: true })).toMatchTypeOf();
|
|
expect(mainDux.selectors.getAntiSub({ subA: true })).toEqual(false);
|
|
});
|