tylercollier / redux-form-test

Shows how to do unit tests and integration tests with Redux-Form
219 stars 26 forks source link

Tests for Enzyme 3 #9

Open mrbinky3000 opened 6 years ago

mrbinky3000 commented 6 years ago

This repo has been very helpful in the past. I wonder if you could update it for react 16, enzyme 3 and redux-form 7?

BarthesSimpson commented 6 years ago

@tylercollier in case it's helpful, after a long day of trying various approaches, I found my integration tests only work if I use process.nextTick, for example:


    const nameInput = page.find('#project_name');
    nameInput.simulate('blur');
    process.nextTick(() => {
      const formGroup = page.find('FormGroup[controlId="project_name"]');
      expect(formGroup.props().validationState).toBe('error');
      expect(
        formGroup.text().indexOf('Project Name is required')
      ).toBeTruthy();
      done();
    });