Can you please provide one example for write testcases for login page? I have written below test case for login page but it not executes. Can you please help me on that ?
import React from 'react';
import Enzyme, { mount } from 'Enzyme';
import EnzymeAdapter from 'enzyme-adapter-react-16';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducer from '../app/reducers/loginReducer';
import Login from '../app/src/crust/containers/Login'
Enzyme.configure({ adapter: new EnzymeAdapter() });
@bhaveshpatel1
I will try to add test cases in future. I'm not sure whether you are saying that you are not bale to write one or execute the test case.
To run test you can use yarn test
Can you please provide one example for write testcases for login page? I have written below test case for login page but it not executes. Can you please help me on that ?
import React from 'react'; import Enzyme, { mount } from 'Enzyme'; import EnzymeAdapter from 'enzyme-adapter-react-16'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import reducer from '../app/reducers/loginReducer'; import Login from '../app/src/crust/containers/Login'
Enzyme.configure({ adapter: new EnzymeAdapter() });
describe(' test', () => {
const mockStore = createStore(reducer, {count: 0});
const getWrapper = () => mount(
);
it('should add to count and display the correct # of counts', () => { const wrapper = getWrapper(); expect(wrapper.find('Text').text()).toEqual('Count: 0'); wrapper.find('Button').simulate('onPress'); expect(wrapper.find('Text').text()).toEqual('Count: 1'); }); });