Reactアプリケーションを作成し、react-boilerplateをベースプロジェクトとして使用しています。 Redux、Sagasとreselectの周りに頭を上げて、最初のコンポーネントを稼働させたら、対応する単体テストを書いてみたいと思います。しかし残念ながら、私は正確にテストするために、対応するセレクタと、SELECT文のための試験を取得することはできませんよ。ジャスミンで `select(reselectSelector)`をテストするには?
const selectDomain =() => (state) => state.get('myDomain');
const selectDomainMessage =() => createSelector(selectDomain(), (domain) => domain.get('message'));
function* send() {
const message = yield select(selectDomainMessage());
...
yield put(sentAction(message);
}
describe('send Saga',() => {
const generator = send();
it('should return select descriptor',() => {
let expectedDescriptor = select(selectDomainMessage());
let returnedDescriptor = generator.next().value;
expect(returnedDescriptor).toEqual(expectedDescriptor);
});
});
を私の視点からは、このテストが動作するはずですが、それは(本当に便利ではないと失敗します)エラーメッセージ:
予想されるオブジェクト({@@ redux-saga/IO:true、SELECT:Object({セレクタ:関数、args:[]}) saga/IO:true、SELECT:Object({selector:Function、args:[]})})。
問題を再現しやすくするために、必要な環境でJSFiddleを作成しました。たぶん誰かが私が間違っていることを教えてくれるかもしれません。