Skip to content

Commit

Permalink
Pass all tests except saga
Browse files Browse the repository at this point in the history
  • Loading branch information
ankeetmaini committed Jan 21, 2020
1 parent 87c88b0 commit 37726cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions example/components/OfflineQueue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { View, StyleSheet, Text, ScrollView } from 'react-native';
import { connect } from 'react-redux';
import { AppState } from '../redux/createStore';

type Props = {
interface Props {
queue: string[];
title: string;
};
}
const OfflineQueue: FunctionComponent<Props> = ({ queue, title }) => {
return (
<View style={{ height: 90, marginVertical: 8 }}>
Expand Down
5 changes: 3 additions & 2 deletions src/components/NetworkConnectivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ class NetworkConnectivity extends React.PureComponent<
const netConnected = await NetInfo.isConnected.fetch();
handler(netConnected);
}

connectivityInterval.setup(this.intervalHandler, pingInterval);
if (pingInterval > 0) {
connectivityInterval.setup(this.intervalHandler, pingInterval);
}
}

componentDidUpdate(prevProps: RequiredProps, prevState: ConnectivityState) {
Expand Down
16 changes: 8 additions & 8 deletions test/ReduxNetworkProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
mapStateToProps,
} from '../src/components/ReduxNetworkProvider';
import { connectionChange } from '../src/redux/actionCreators';
import { NetworkState } from '../src/types';

const dispatch = jest.fn();
const props = {
Expand Down Expand Up @@ -70,14 +69,15 @@ describe('ReduxNetworkProvider', () => {

describe('mapStateToProps', () => {
it('maps isConnected and actionQueue state to props', () => {
const networkState: NetworkState = {
isConnected: false,
actionQueue: [],
isQueuePaused: false,
};
const expected = { isConnected: false };
const state = {
network: networkState,
network: {
actionQueue: [],
isQueuePaused: false,
...expected,
},
};
expect(mapStateToProps(state)).toEqual(networkState);

expect(mapStateToProps(state)).toEqual(expected);
});
});

0 comments on commit 37726cf

Please sign in to comment.