Я делаю первые шаги с ReactJS
и Jest
.Почему это сравнение строк в Jest не ожидается?
Ожидание ниже проходит, хотя оно не должно. Посмотрите, как печатается свойство:
console.log(searchBox.props.url_variation);
// prints: curation/get_site_variations/
Так почему же ожидать не провал?
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/'
});
});