jest経由で叙事詩をテストすると、テストに失敗します。jsdom:nullの '_location'プロパティを読み取れません
Test Failed
/.../node_modules/jsdom/lib/jsdom/browser/Window.js:148
return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._location);
TypeError: Cannot read property '_location' of null
at Window.get location [as location] (/.../node_modules/jsdom/lib/jsdom/browser/Window.js:148:79)
at Timeout.callback [as _onTimeout] (/.../node_modules/jsdom/lib/jsdom/browser/Window.js:525:40)
at ontimeout (timers.js:380:14)
at tryOnTimeout (timers.js:244:5)
at Timer.listOnTimeout (timers.js:214:5)
これは私のテストの一部です。私はfetch()を使用し、fetchCategoriesEpicで約束しました。
it('test epic',() => {
...
const action$ = ActionsObservable.of({ type: FETCH_CATEGORIES })
fetchCategoriesEpic(action$)
.toArray() // collects everything in an array until our epic completes
.subscribe((actions) => {
expect(actions).toEqual([
{ type: FETCH_CATEGORIES },
{ type: FETCH_CATEGORIES_SUCCESS, payload: List(payload.data).map((category) => new Category(category)) }
])
})
...
}
どうすればこの問題を解決できますか?