I'm currently encountering this error in my unit testing wherein I cannot find the element with an specific classname after I simulate the form submit:
HTML Element in inspect element:
<div class="ant-form-item-control has-error">
<input type="text" class="ant-input ant-input-lg addSiteBasics_businessName" value="" placeholder="English Business Name" id="businessName">
<div class="ant-form-explain">Please add the name of your business.</div>
</div>
Test Script:
describe('given business name is empty', () => {
it('display error if business name empty', () => {
const form = wrapper.find('form').first();
form.simulate('submit');
expect(wrapper.find('div.has-error #businessName').exists()).toBe(true);
})
});
This is the error that displays in my terminal:
expect(received).toBe(expected)
Expected value to be (using ===): true Received: false