update action generation

This commit is contained in:
2019-02-26 18:09:38 +01:00
parent eae70135d5
commit a4d43456d7
3 changed files with 37 additions and 17 deletions

View File

@ -30,12 +30,20 @@ tap.test('should create a new StatePart', async () => {
tap.test('should select something', async () => {
testStatePart
.select(state => state.deep)
.select(state => state.deep.hi)
.subscribe(substate => {
console.log(substate);
expect(substate).to.equal(2);
});
});
tap.test('should dispatch a state action', async () => {});
tap.test('should dispatch a state action', async () => {
const addFavourite = testStatePart.createAction<string>(async (statePart, payload) => {
const currentState = statePart.getState();
currentState.currentFavorites.push(payload)
return currentState;
});
await testStatePart.dispatchAction(addFavourite, 'my favourite things')
expect(testStatePart.getState().currentFavorites).to.include('my favourite things')
});
tap.start();