Skip to content

Commit

Permalink
Ammended tests and snapshots for new updates to router and react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Muniz committed Mar 20, 2018
1 parent 492e1cf commit 299dfdb
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 56 deletions.
62 changes: 26 additions & 36 deletions __tests__/views/__snapshots__/Home.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders without crashing 1`] = `
<MenuProvider
backHandler={false}
customStyles={Object {}}
<View
style={
Object {
"flex": 1,
"backgroundColor": "#EAEAEA",
"flexGrow": 1,
}
}
>
<View
style={
Object {
"backgroundColor": "#EAEAEA",
"flexGrow": 1,
}
}
<ScrollView
onScroll={[Function]}
scrollEventThrottle={69}
>
<ScrollView
onScroll={[Function]}
scrollEventThrottle={69}
>
<Connect(WeatherCardContainer)
key="weather"
/>
<Connect(ShuttleCardContainer)
key="shuttle"
/>
<Connect(DiningCardContainer)
key="dining"
/>
<Connect(EventCardContainer)
key="events"
/>
<Connect(QuicklinksCardContainer)
key="quicklinks"
/>
<Connect(NewsCardContainer)
key="news"
/>
</ScrollView>
</View>
</MenuProvider>
<Connect(WeatherCardContainer)
key="weather"
/>
<Connect(withNavigation(ShuttleCardContainer))
key="shuttle"
/>
<Connect(DiningCardContainer)
key="dining"
/>
<Connect(EventCardContainer)
key="events"
/>
<Connect(QuicklinksCardContainer)
key="quicklinks"
/>
<Connect(NewsCardContainer)
key="news"
/>
</ScrollView>
</View>
`;
4 changes: 2 additions & 2 deletions __tests__/views/dining/DiningCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import Adapter from 'enzyme-adapter-react-16';

// Component to be tested
import { DiningCardContainer } from '../../../app/views/dining/DiningCardContainer';
import DataListCard from '../../../app/views/common/DataListCard';
import { DINING_RESPONSE } from '../../../mockApis/diningAPI';
import { DataListCard } from '../../../app/views/common/DataListCard';
import { DINING_RESPONSE } from '../../../mockApis/diningApi';

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

Expand Down
3 changes: 1 addition & 2 deletions __tests__/views/dining/__snapshots__/DiningCard.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Sat & Sun: 10 am - 8 pm",
`;

exports[`container renders without crashing 1`] = `
<DataListCard
<withNavigation(DataListCard)
data={
Array [
Object {
Expand Down Expand Up @@ -179,7 +179,6 @@ Sat & Sun: 10 am - 8 pm",
}
id="dining"
item="DiningItem"
rows={3}
title="Dining"
/>
`;
2 changes: 1 addition & 1 deletion __tests__/views/events/EventCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Adapter from 'enzyme-adapter-react-16';

// Component to be tested
import { EventCardContainer } from '../../../app/views/events/EventCardContainer';
import DataListCard from '../../../app/views/common/DataListCard';
import { DataListCard } from '../../../app/views/common/DataListCard';
import { EVENTS_RESPONSE } from '../../../mockApis/eventsApi';

Enzyme.configure({ adapter: new Adapter() });
Expand Down
3 changes: 1 addition & 2 deletions __tests__/views/events/__snapshots__/EventCard.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`card renders without crashing 1`] = `
`;

exports[`container renders without crashing 1`] = `
<DataListCard
<withNavigation(DataListCard)
data={
Array [
Object {
Expand Down Expand Up @@ -111,7 +111,6 @@ exports[`container renders without crashing 1`] = `
}
id="events"
item="EventItem"
rows={3}
title="Events"
/>
`;
2 changes: 1 addition & 1 deletion __tests__/views/news/NewsCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Adapter from 'enzyme-adapter-react-16';

// Component to be tested
import { NewsCardContainer } from '../../../app/views/news/NewsCardContainer';
import DataListCard from '../../../app/views/common/DataListCard';
import { DataListCard } from '../../../app/views/common/DataListCard';
import { NEWS_RESPONSE } from '../../../mockApis/newsApi';

Enzyme.configure({ adapter: new Adapter() });
Expand Down
3 changes: 1 addition & 2 deletions __tests__/views/news/__snapshots__/NewsCard.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exports[`card renders without crashing 1`] = `
`;

exports[`container renders without crashing 1`] = `
<DataListCard
<withNavigation(DataListCard)
data={
Array [
Object {
Expand All @@ -85,7 +85,6 @@ exports[`container renders without crashing 1`] = `
}
id="news"
item="NewsItem"
rows={3}
title="News"
/>
`;
2 changes: 1 addition & 1 deletion __tests__/views/quicklinks/QuicklinksCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Adapter from 'enzyme-adapter-react-16';

// Component to be tested
import { QuicklinksCardContainer } from '../../../app/views/quicklinks/QuicklinksCardContainer';
import DataListCard from '../../../app/views/common/DataListCard';
import { DataListCard } from '../../../app/views/common/DataListCard';
import general from '../../../app/util/general';
import { QUICKLINKS_RESPONSE } from '../../../mockApis/quicklinksApi';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ exports[`card renders without crashing 1`] = `
`;

exports[`container renders without crashing 1`] = `
<DataListCard
<withNavigation(DataListCard)
cardSort={[Function]}
data={
Array [
Expand Down
7 changes: 5 additions & 2 deletions __tests__/views/shuttle/ShuttleCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Adapter from 'enzyme-adapter-react-16';

// Component to be tested
import { ShuttleCardContainer } from '../../../app/views/shuttle/ShuttleCardContainer';
import ShuttleCard from '../../../app/views/shuttle/ShuttleCard';
import { ShuttleCard } from '../../../app/views/shuttle/ShuttleCard';
import {
CLOSEST_STOP,
SHUTTLE_STOPS_DATA,
Expand All @@ -32,7 +32,10 @@ const initialCardState = {
gotoRoutesList: jest.fn(),
removeStop: jest.fn(),
updateScroll: jest.fn(),
lastScroll: 0
lastScroll: 0,
navigation: {
navigate: jest.fn()
}
};

// Set up container to be rendered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports[`card renders without crashing 1`] = `
`;

exports[`container renders without crashing 1`] = `
<ShuttleCard
<withNavigation(ShuttleCard)
gotoRoutesList={[Function]}
gotoSavedList={[Function]}
lastScroll={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`card renders without crashing 1`] = `
`;

exports[`container renders without crashing 1`] = `
<SpecialEventsCard
<withNavigation(SpecialEventsCard)
hideCard={[MockFunction]}
saved={Array []}
specialEvents={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,14 @@ exports[`card renders without crashing 1`] = `
}
}
/>
<SurfButton />
<withNavigation(SurfButton) />
</View>
</Connect(Card)>
`;

exports[`container renders without crashing 1`] = `
<WeatherCard
actionButton={<SurfButton />}
actionButton={<withNavigation(SurfButton) />}
weatherData={
Object {
"currently": Object {
Expand Down
2 changes: 1 addition & 1 deletion app/views/common/DataListCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
* @param {Function} cardSort array sorting function
* @return {JSX} Generic component for list type cards
*/
const DataListCard = ({ navigation, id, title, data, item, rows, cardSort }) => {
export const DataListCard = ({ navigation, id, title, data, item, rows, cardSort }) => {
let sortedData = data;
if (cardSort && sortedData) {
sortedData = sortedData.slice().sort(cardSort);
Expand Down
2 changes: 1 addition & 1 deletion app/views/shuttle/ShuttleCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
MAX_CARD_WIDTH
} from '../../styles/LayoutConstants';

const ShuttleCard = ({ navigation, stopsData, savedStops, gotoRoutesList, gotoSavedList, updateScroll, lastScroll }) => {
export const ShuttleCard = ({ navigation, stopsData, savedStops, gotoRoutesList, gotoSavedList, updateScroll, lastScroll }) => {
const extraActions = [
{
name: 'Manage Stops',
Expand Down

0 comments on commit 299dfdb

Please sign in to comment.