title: Test case React with Node js
body: <p>My site is using react and node . For that I created the test case using enzyme at react side  and from server site I am using Mocha. Both are working correctly when I am using terminal command (npm test) its showing fail ans success result. But I want to do test case from ui interface . </p>
  
  <p>Basically i want to backed (nodejs) function  fronted with one command, Now my test case working on different terminal For example for react I am opened in one terminal and for node side test case I oped another terminal.</p>
  
  <p>this is my node side code :-</p>
  
  <pre><code>const request = require('supertest');
  const expect = require('chai').expect;
  const req = 'http://localhost:3000';
   this.user_id = '';
  
  describe('Register form', function() {
      it('User saved successfully in database', function(done) {
          request(req)
             .post('/users/register')
             .set('Accept', 'application/json')
             .set('Content-Type', 'application/json')
             .send({user:{disabled: false,
                      email: "dineshsharma.developer@gmail.com",
                      firstName: "test",
                      lastName: "test",
                      password: "24234234ds",
                      roles: "hr",
                      status: "verified"}})
             .expect(200)
             .expect('Content-Type', /json/)
             .expect(function(response) {
             })
             .end(done);
      }); 
  });
  </code></pre>
  
  <p>and this is react side code:-</p>
  
  <pre><code>import React from 'react';
  import { Link } from 'react-router-dom';
  import { connect } from 'react-redux';
  import Select from 'react-select'
  import config from 'config';
  import { Alert } from 'reactstrap';
  import { userActions } from '../../../src/actions';
  
  import Enzyme, {shallow,mount,render,unmount} from 'enzyme';
  import Adapter from 'enzyme-adapter-react-16';
  import RegisterPage from '../../../src/features/RegisterPage/RegisterPage';
  import { MemoryRouter } from 'react-router-dom';
  
  Enzyme.configure({adapter: new Adapter()});
  
  describe('In register page check react syntex', () =&gt; {
    it('Should RegisterPage shallow correctly in "debug" mode', () =&gt; {
      const component = (&lt;RegisterPage debug /&gt;);
      expect(component).toMatchSnapshot();
    });
  }); 
  
  describe('On register page count input filed', () =&gt; {
       it('Total text filed', () =&gt; {
        expect(shallow(&lt;RegisterPage /&gt;).find('input[type="text"]').length).toEqual(2)
       })
      it('Total email filed', () =&gt; {
        expect(shallow(&lt;RegisterPage /&gt;).find('input[type="email"]').length).toEqual(1)
       })
      it('Total checkbox filed', () =&gt; {
        expect(shallow(&lt;RegisterPage /&gt;).find('input[type="checkbox"]').length).toEqual(1)
       })
      it('Total radio filed', () =&gt; {
        expect(shallow(&lt;RegisterPage /&gt;).find('input[type="radio"]').length).toEqual(2)
       })
  }); 
  
  
  describe('On Register page check firstname , lastname or email address vaildation', () =&gt; {  
    it('Check first name in registerpage ', () =&gt; {
     const wrapper = mount(&lt;RegisterPage /&gt;);
     wrapper.find('input[name="firstName"]').simulate('change', {target: {name: 'firstName', value: 'dinesh'}}); 
     expect(wrapper.state().user.firstName).toEqual('dinesh');    
    })
  
    it('Check lastname in register page ', () =&gt; {
     const wrapper = mount(&lt;RegisterPage /&gt;);
     wrapper.find('input[name="lastName"]').simulate('change', {target: {name: 'lastName', value: 'Sharma'}});
     expect(wrapper.state().user.lastName).toEqual('Sharma');   
    })
  
    it('Check email address in register page', () =&gt; {
    const wrapper = mount(&lt;RegisterPage /&gt;);
    wrapper.find('input[name="email"]').simulate('change', {target: {name: 'email', value: 'dineshsharma.developer@gmail.com'}});
    expect(wrapper.state().user.email).toEqual('dineshsharma.developer@gmail.com');   
    })
  
  })
  </code></pre>