I am trying to run tests on my react
components but I am getting this error when I console.log(nav)
error:
Chrome 44.0.2403 (Mac OS X 10.10.4) App has nav FAILED
Error: the error "TypeError: target.dispatchEvent is not a function" was thrown, throw an Error :)
code:
import React from 'react/addons';
var TestUtils = React.addons.TestUtils;
import testHelper from '../../test/helpers/testHelper.js';
import App from '../../app/views/app.js';
var app = testHelper.getRouterComponent(App);
describe('App', function() {
it('has nav', function(done) {
var nav = TestUtils.findRenderedDOMComponentWithTag(app, 'nav');
console.log(nav);
expect(nav).to.exist;
done();
});
});
Not quite sure how to debug this or why this is occurring. When I removed the console.log(nav)
the error does not appear.
Instead of console.log
try :
console.log(require('util').inspect(nav, { depth: null }));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With