test('renders correctly', () => { const wrapper = shallow( <App /> ); expect(toJson(wrapper)).toMatchSnapshot(); });
describe('<Client />', () => { it('should render correctly', () => { const wrapper = mount( <Client /> ); expect(toJson(wrapper)).toMatchSnapshot(); }); });
test('snapshot', () => { const props = { title: 'Test Product', children: 'Test Children', } const { comp } = setup(props) expect(toJson(comp)).toMatchSnapshot() })
describe('Home', () => { it('should load without crashing', () => { const store = mockStore({ myReducer: { inputValueFromReducer: '' } }); const wrapper = mount(<Home store={store} />); expect(toJson(wrapper)).toMatchSnapshot(); }); });
describe('Dynamic Error component', () => { it('Does not render without show prop passed', () => { const wrapper = shallow(<DynamicError message="An Error occured" />); expect(wrapper).toEqual({}); }); it('Renders currectly (Matches Snapshot) with show and message props', () => { const wrapper = shallow(<DynamicError show message="An Error occured" />); expect(toJson(wrapper)).toMatchSnapshot(); }); });
describe('Add User Button component', () => { it('Renders button correctly (matches snapshot)', () => { expect(toJson(wrapper)).toMatchSnapshot(); }); it('Emits action correctly on button click', () => { let testValue; const testFunc = item => { testValue = item; }; wrapper.setProps({ action: testFunc }); wrapper.simulate('click'); expect(testValue).toEqual('given item'); }); });
describe('Error page component', () => { it('Renders error message thas is passed via props correctly', () => { const errorMessage = wrapper.find(Text).text(); expect(errorMessage).toEqual('Error message'); }); it('Matches snapshot', () => { expect(toJson(wrapper)).toMatchSnapshot(); }); });
describe('App', () => { it('renders matching snapshot', () => { const { wrapper } = setup() expect(toJson(wrapper)).toMatchSnapshot() }) })
describe('<App/>',() => { it("spanshot matches", () => { const tree = shallow(<App />); expect(toJson(tree)).toMatchSnapshot(); }); });
describe('<Starlight />', () => { it('should render correctly', () => { const wrapper = shallow( <Starlight></Starlight> ); expect(toJson(wrapper)).toMatchSnapshot(); }); });
describe('Loading page component', () => { it('Matches snapshot', () => { const wrapper = shallow(<Loading header="My Header" />); expect(toJson(wrapper)).toMatchSnapshot(); }); });
describe('<Footer />', () => { it('renders correctly', () => { const wrapper = shallow(<Footer />); expect(toJson(wrapper)).toMatchSnapshot(); }); });
describe("<QuestionCard/>", () => { it("spanshot matches", () => { const tree = shallow(<QuestionCard id question userAnswersUpdate/>); expect(toJson(tree)).toMatchSnapshot(); }); });
describe('App presentation', () => { it('should render App component', () => { const result = shallow(<App />); expect(toJson(result)).toMatchSnapshot(); }); });
describe('Header component', () => { it('Renders Header Title passed via props correctly', () => { const title = wrapper.find(H1).text(); expect(title).toEqual('My Header'); }); it('Matches snapshot', () => { expect(toJson(wrapper)).toMatchSnapshot(); }); });