Ich verwende "ava" Rahmen für die Prüfung zu reagieren, hier ein Stück package.json ist:Zugang zu globalen Namensraum mit ava Test
"babel": {
"presets": [
"es2015",
"stage-2",
"react"
]
},
"ava": {
"babel": "inherit",
"require": [
"babel-register"
]
}
Code des Tests:
import store from '../../app/redux/store';
import test from 'ava';
import * as c from '../../app/constants'
test('languageReducer() should correctly change the dictionary', t => {
store.dispatch({
type: c.LOCALIZE_CHANGE_DICTIONARY,
dictionary: {
a: 1,
b: 2,
c: 3
}
});
t.DeepEqual(store.getState().localizeReducer.dictionary, {a: 1, b: 2, c: 3});
t.is(10, 10);
});
und wird Fehler klingt wie:
unsubscribeHistory = history.listen(function (location) {
^
TypeError: Cannot read property 'listen' of undefined
at middleware (/Users/nikita/WebstormProjects/crm_panel/node_modules/redux-simple- router/lib/index.js:72:33)
Was soll ich tun, um meine Tests Zugang zu den globalen Namensraum (Fenster, Geschichte, etc.) geben? Danke