Open denchen opened 3 years ago
I have a custom effect called takeLeadingPerKey() which is based off of takeLeading() but allows multiple sagas to run as long as they have a unique key.
takeLeadingPerKey()
takeLeading()
I'm not sure how to use it with testSaga()
testSaga()
Example code:
/** * takeLeadingPerKey() signature: * function takeLeadingPerKey(patternOrChannel, worker, keySelector, ...args) */ function* doSomething(action) { // Do something } function selectKey(action) { return action.meta.key; } export function* mySaga() { yield takeLeadingPerKey( 'MY_TYPE', doSomething, selectKey ); }
Example test:
testSaga(mySaga) .next() .takeLeadingPerKey('MY_TYPE', doSomething, selectKey) .next() .isDone();
With the above, I get:
TypeError: (0 , _reduxSagaTestPlan.testSaga)(...).next(...).takeLeadingPerKey is not a function
Obviously it's complaining that takeLeadingPerKey() doesn't exist with testSaga(), so is there another way to test this?
I have a custom effect called
takeLeadingPerKey()
which is based off oftakeLeading()
but allows multiple sagas to run as long as they have a unique key.I'm not sure how to use it with
testSaga()
Example code:
Example test:
With the above, I get:
Obviously it's complaining that
takeLeadingPerKey()
doesn't exist withtestSaga()
, so is there another way to test this?