Skip to content

Commit

Permalink
fga-eps-mds#175 - Fitting source code to style sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronyell authored and ThalissonMelo committed Jun 12, 2018
1 parent dcf2b4e commit 22f0cfc
Show file tree
Hide file tree
Showing 19 changed files with 920 additions and 615 deletions.
10 changes: 5 additions & 5 deletions Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import FoodHandlerCheckoutContainer from './src/Containers/reports/FoodHandlerCh
import WaterSewerSupplyCheckoutContainer from './src/Containers/reports/WaterSewerSupplyCheckoutContainer';
import FoodPreparationCheckoutContainer from './src/Containers/reports/FoodPreparationCheckoutContainer';
import PrincipalStartInspection from './src/screens/startInspection/PrincipalStartInspection';
// import ScheduleMeetingContainer from './src/Containers/scheduleMeeting/ScheduleMeetingContainer';;;
import ScheduleMeetingContainer from './src/Containers/scheduleMeeting/ScheduleMeetingContainer';;;
// import ScheduleMeetingMapContainer from './src/Containers/scheduleMeeting/ScheduleMeetingMapContainer';
import PrincipalManageRegister from './src/screens/manageCounselors/PrincipalManageRegister';
import MainLegislationScreen from './src/screens/legislation/MainLegislationScreen';
Expand Down Expand Up @@ -60,11 +60,11 @@ const Routes = () => ({
hideNavBar
/> */}
<Scene key="schedulingVisit" component={SchedulingVisitContainer} hideNavBar />
{/* <Scene
<Scene
key="scheduleMeeting"
component={ScheduleMeetingContainer}
hideNavBar
/> */}
/>
<Scene key="manageRegisters" component={PrincipalManageRegister} hideNavBar />
<Scene key="mainScreen" component={MainScreenContainer} type="reset" hideNavBar />
<Scene key="searchSchool" component={SearchSchoolContainer} hideNavBar />
Expand Down Expand Up @@ -92,12 +92,12 @@ const Routes = () => ({
hideNavBar
/> */}
<Scene key="schedulingVisit" component={SchedulingVisitContainer} hideNavBar />
{/* <Scene
<Scene
key="scheduleMeeting"
component={ScheduleMeetingContainer}
type="reset"
hideNavBar
/> */}
/>
<Scene
key="stockFoodCheckoutScreen"
component={StockFoodCheckoutScreenContainer}
Expand Down
241 changes: 241 additions & 0 deletions __tests__/screens/ScheduleMeeting.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
import React from 'react';
import Enzyme, { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import configureStore from 'redux-mock-store';
import ScheduleMeetingContainer from '../../src/Containers/scheduleMeeting/ScheduleMeetingContainer';
import ScheduleMeeting from '../../src/screens/scheduleMeeting/ScheduleMeeting';

Enzyme.configure({ adapter: new Adapter() });

const mockStore = configureStore();

const initialState = {
application: {
isLoading: false,
},
counselor: {
profile: {
CAE: 'Distrito Federal',
},
},

schedule: {
codSchool: 0,
meetingLatitude: null,
meetingLongitude: null,
},

appToken: 'genericalToken',
nuvemCode: 1,
meeting: {
date: '31-12-2017',
time: '10:00',
lat: 5.00,
long: 13.00,
meetingDescription: '',
},


list: {
listOfCounselorsInAGroup: [
{
name: 'Lucas Penido Antunes',
profile: {
cpf: '11111111111',
phone: '11111111111',
},
},
],

meetingListOfInviteesWithCounselorInformations: {
6122: {
nuvemCode: 6122,
name: 'Lucas Penido Antunes',
cpf: '11111111111',
phone: '11111111111',
},
6201: {
nuvemCode: 6201,
name: 'Kamilla Costa Souzaa',
cpf: '00000000000',
phone: '99999999999',
},
},

meetingListOfInvitees: {
6122: {
nuvemCode: 6122,
confirmed: false,
},
6201: {
nuvemCode: 6201,
confirmed: false,
},
},
},
asyncGetCounselorFromGroup: jest.fn(),
};

const initialStateToScreen = {
counselor: {
token: 'genericalToken',

profile: {
CAE: 'DF',
},
},

scheduleMeeting: {
codSchool: 0,
meetingLatitude: 0.0,
meetingLongitude: 0.0,
},
appToken: 'genericalToken',
nuvemCode: 1,

meeting: {
lat: 5.00,
long: 13.00,
date: '31-10-2017',
time: '19:50',
meetingDescription: '',
},

listOfCounselorsInAGroup: [
{
name: 'Lucas Penido Antunes',
profile: {
cpf: '11111111111',
phone: '11111111111',
},
},
],

meetingListOfInviteesWithCounselorInformations: {
6122: {
nuvemCode: 6122,
name: 'Lucas Penido Antunes',
cpf: '11111111111',
phone: '11111111111',
},
6201: {
nuvemCode: 6201,
name: 'Kamilla Costa Souzaa',
cpf: '00000000000',
phone: '99999999999',
},
},

meetingListOfInvitees: {
6122: {
nuvemCode: 6122,
confirmed: false,
},
6201: {
nuvemCode: 6201,
confirmed: false,
},
},

asyncGetCounselorFromGroup: jest.fn(),
};

const store = mockStore(initialState);


describe('Testing ScheduleMeeting Screen', () => {
it('renders as expected', () => {
const wrapper = shallow(
<ScheduleMeetingContainer />,
{ context: { store } },
);
expect(wrapper).toMatchSnapshot();
});
});

describe('Testing ScheduleMeeting buttons', () => {
it('Test if goToMeetingMaps Button is rendered', () => {
jest.mock('react-native-router-flux');
const wrapper = shallow(<ScheduleMeeting {...initialStateToScreen} />);
console.log(initialStateToScreen);
const button = wrapper.findWhere(c => c.key() === 'openMeetingMap');
expect(button.length).toEqual(1);
button.simulate('press');
});

it('Test if openMeetingLocation Button is rendered', () => {
const wrapper = shallow(<ScheduleMeeting {...initialStateToScreen} />);
const button = wrapper.findWhere(c => c.key() === 'openMeetingLocation');
expect(button.length).toEqual(1);
button.simulate('press');
});

it('Test if inviteCounselors Button is rendered', () => {
const wrapper = shallow(<ScheduleMeeting {...initialStateToScreen} />);
const button = wrapper.findWhere(c => c.key() === 'searchCounselorButton');
expect(button.length).toEqual(1);
// We are not simulating button press because
// we faced problemns with .show from popUp
// button.simulate('press');
});
it('Test if schedule button is rendered', () => {
const asyncSchedulingMeeting = (state) => {
expect(state.nuvemCode).toEqual(1);
expect(state.appToken).toEqual('tokenGenerico');
expect(state.meeting.date).toEqual('31-12-2017');
expect(state.meeting.time).toEqual('18:30');
expect(state.meeting.lat).toEqual(0.00);
expect(state.meeting.long).toEqual(0.00);
};

const wrapper = shallow(<ScheduleMeeting
{...initialStateToScreen}
/>);

wrapper.setState({
nuvemCode: 1,
token: 'tokenGenerico',
meeting: {
date: '31-12-2017',
time: '18:30',
lat: 0.00,
long: 0.00,
meetingDescription: '',
meetingListOfInvitees: {
6122: {
nuvemCode: 6122,
confirmed: false,
},
6201: {
nuvemCode: 6201,
confirmed: false,
},
},
},
});

const button = wrapper.findWhere(c => c.key() === 'scheduleMeetingButton');
expect(button.length).toEqual(1);
});
it('Test if meetingDescription updates', () => {
const wrapper = shallow(<ScheduleMeeting {...initialStateToScreen} />);
const describeInputComponent = wrapper.find('TextInput').at(0);
describeInputComponent.simulate('ChangeText', 'descricao');
expect(wrapper.state().meeting.meetingDescription).toEqual('descricao');
});
});

describe('Testing ScheduleMeeting DatePickers', () => {
const wrapper = shallow(<ScheduleMeeting {...initialStateToScreen} />);

it('Test if date changes when DatePicker changes', () => {
const datePickerComponent = wrapper.find('DatePicker').at(0);
datePickerComponent.simulate('dateChange', '31-10-2017');
expect(wrapper.state().meeting.date).toEqual('31-10-2017');
});
it('Test if time changes when DatePicker changes', () => {
const datePickerComponent = wrapper.find('DatePicker').at(1);
datePickerComponent.simulate('dateChange', '19:50');
expect(wrapper.state().meeting.time).toEqual('19:50');
});
});
56 changes: 56 additions & 0 deletions __tests__/screens/__snapshots__/ScheduleMeeting.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Testing ScheduleMeeting Screen renders as expected 1`] = `
<ScheduleMeeting
asyncGetCounselorFromGroup={[Function]}
asyncSchedulingMeeting={[Function]}
counselor={
Object {
"profile": Object {
"CAE": "Distrito Federal",
},
}
}
isLoading={false}
listOfCounselorsInAGroup={
Array [
Object {
"name": "Lucas Penido Antunes",
"profile": Object {
"cpf": "11111111111",
"phone": "11111111111",
},
},
]
}
meetingListOfInvitees={
Object {
"6122": Object {
"confirmed": false,
"nuvemCode": 6122,
},
"6201": Object {
"confirmed": false,
"nuvemCode": 6201,
},
}
}
meetingListOfInviteesWithCounselorInformations={
Object {
"6122": Object {
"cpf": "11111111111",
"name": "Lucas Penido Antunes",
"nuvemCode": 6122,
"phone": "11111111111",
},
"6201": Object {
"cpf": "00000000000",
"name": "Kamilla Costa Souzaa",
"nuvemCode": 6201,
"phone": "99999999999",
},
}
}
setMeetingNewLists={[Function]}
/>
`;
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ merenda-merenda:
lsusb
npm install --loglevel verbose
adb reverse tcp:8081 tcp:8081
echo 256 | tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | tee -a /proc/sys/fs/inotify/max_user_watches
react-native run-android
"
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { AppRegistry } from 'react-native';
import App from './App';
AppRegistry.registerComponent('MerendaMais', () => App);
42 changes: 21 additions & 21 deletions src/Containers/scheduleMeeting/ScheduleMeetingContainer.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
// import { connect } from 'react-redux';
// import ScheduleMeeting from '../../screens/scheduleMeeting/ScheduleMeeting';
// import asyncSchedulingMeeting from '../../actions/schedulingMeetingActions';
// import { asyncGetCounselorFromGroup, setMeetingNewLists } from '../../actions/listActions';
import { connect } from 'react-redux';
import ScheduleMeeting from '../../screens/scheduleMeeting/ScheduleMeeting';
import asyncSchedulingMeeting from '../../actions/schedulingMeetingActions';
import { asyncGetCounselorFromGroup, setMeetingNewLists } from '../../actions/listActions';

// const mapStateToProps = state => ({
// isLoading: state.application.isLoading,
// listOfCounselorsInAGroup: state.list.listOfCounselorsInAGroup,
// meetingListOfInviteesWithCounselorInformations:
// state.list.meetingListOfInviteesWithCounselorInformations,
// meetingListOfInvitees: state.list.meetingListOfInvitees,
// counselor: state.counselor,
// scheduleMeeting: state.scheduleMeeting,
// });
const mapStateToProps = state => ({
isLoading: state.application.isLoading,
listOfCounselorsInAGroup: state.list.listOfCounselorsInAGroup,
meetingListOfInviteesWithCounselorInformations:
state.list.meetingListOfInviteesWithCounselorInformations,
meetingListOfInvitees: state.list.meetingListOfInvitees,
counselor: state.counselor,
scheduleMeeting: state.scheduleMeeting,
});

// const mapDispatchToProps = dispatch => ({
// asyncGetCounselorFromGroup: (CAE, CPF) => dispatch(asyncGetCounselorFromGroup(CAE, CPF)),
const mapDispatchToProps = dispatch => ({
asyncGetCounselorFromGroup: (CAE, CPF) => dispatch(asyncGetCounselorFromGroup(CAE, CPF)),

// asyncSchedulingMeeting: meetingData => dispatch(asyncSchedulingMeeting(meetingData)),
asyncSchedulingMeeting: meetingData => dispatch(asyncSchedulingMeeting(meetingData)),

// setMeetingNewLists: meetingNewListWithInformations =>
// dispatch(setMeetingNewLists(meetingNewListWithInformations)),
// });
setMeetingNewLists: meetingNewListWithInformations =>
dispatch(setMeetingNewLists(meetingNewListWithInformations)),
});

// const ScheduleMeetingContainer = connect(mapStateToProps, mapDispatchToProps)(ScheduleMeeting);
const ScheduleMeetingContainer = connect(mapStateToProps, mapDispatchToProps)(ScheduleMeeting);

// export default ScheduleMeetingContainer;
export default ScheduleMeetingContainer;
Loading

0 comments on commit 22f0cfc

Please sign in to comment.