I am taking my first steps with ReactJS
and Jest
.
The expect below passes, even though it shouldn't. console.log(searchBox.props.url_variation); // prints: curation/get_site_variations/
So why is the expect not failing?
jest.dontMock('../databank_web/static/js/curation_tools/SearchBox.js');
describe('SearchBox', function () {
it('loads results after click', function () {
var React = require('react/addons');
var TestUtils = React.addons.TestUtils;
var SearchBox = require('../databank_web/static/js/curation_tools/SearchBox.js');
// Render the form?
var searchBox = TestUtils.renderIntoDocument(<SearchBox
url_variation="curation/get_site_variations/"
url_golden="curation/golden_record/"/>);
console.log(searchBox.props.url_variation); // prints: curation/get_site_variations/
expect(searchBox.props.url_variation === "fail");
// Why is this passing? fail is not equal to 'curation/get_site_variations/'
});
});
Aucun commentaire:
Enregistrer un commentaire