import React from 'react';
import ReactDOM from 'react-dom';
import { shallow } from 'enzyme';
import App from './../App';
import ErrorMsg from './../ErrorMsg';
import LoadingMsg from './../LoadingMsg';

describe('App', () => {
	it('renders without crashing', () => {
		const div = document.createElement('div');
		ReactDOM.render(<App />, div);
	});
	it('shows loading component before first state update', () => {
		const component = shallow(<App lat={16.5} />);
		expect(component.find(LoadingMsg)).toHaveLength(1);
	});
	it('shows error when state is updated to error', () => {
		const component = shallow(<App lat={16.5} />);

		component.setState(
			{error: {
				name: 'TEST ERROR NAME',
				message: 'TEST ERROR MESSAGE'
			}}
		);
		expect(component.find(ErrorMsg)).toHaveLength(1);
	});
});

@@ -195,16 +195,59 @@
 ingMsg';
+%0Aimport TimeTable from './../TimeTable.js';
 %0A%0Adescri
@@ -480,35 +480,24 @@
 shallow(%3CApp
- lat=%7B16.5%7D
  /%3E);%0A%09%09expe
@@ -643,19 +643,8 @@
 %3CApp
- lat=%7B16.5%7D
  /%3E)
@@ -755,16 +755,16 @@
 %7D%7D%0A%09%09);%0A
-
 %09%09expect
@@ -812,12 +812,309 @@
 );%0A%09%7D);%0A
+%09it('shows timetable when state is updated to valid state', () =%3E %7B%0A%09%09const component = shallow(%3CApp /%3E);%0A%09%09//const nearest = require('../__mocks__/NearestQueryResponse.json');%0A%0A%09%09component.setState(%7Blat: 0, lon:0%7D);%0A%09%09component.update();%0A%09%09expect(component.find(TimeTable)).toHaveLength(1);%0A%09%7D);%0A
 %7D);%0A

Add valid state test.