27 lines
494 B
JavaScript
27 lines
494 B
JavaScript
import { test, expect } from 'vitest';
|
|
|
|
import { dux } from './Updux.js';
|
|
|
|
test( "basic selectors", () => {
|
|
|
|
const foo = dux({
|
|
initial: {
|
|
x: 1,
|
|
},
|
|
selectors: {
|
|
getX: ({x}) => x,
|
|
},
|
|
subduxes: {
|
|
bar: {
|
|
initial: { y: 2 },
|
|
selectors: {
|
|
getY: ({y}) => y
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
expect( foo.selectors.getY({bar:{y:3}} ) ).toBe(3);
|
|
|
|
} );
|