Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit db2b5dd

Browse files
authored
Merge branch 'master' into patch-no-any
2 parents e6060a6 + b393f15 commit db2b5dd

File tree

19 files changed

+2669
-1153
lines changed

19 files changed

+2669
-1153
lines changed

app/components/Footer/tests/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import React from 'react';
22
import renderer from 'react-test-renderer';
33
import { IntlProvider } from 'react-intl';
44
import { Provider } from 'react-redux';
5-
import { browserHistory } from 'react-router-dom';
65

76
import Footer from '../index';
87
import configureStore from '../../../configureStore';
8+
import history from '../../../utils/history';
99

1010
describe('<Footer />', () => {
1111
let store;
1212

1313
beforeAll(() => {
14-
store = configureStore({}, browserHistory);
14+
store = configureStore({}, history);
1515
});
1616

1717
it('should render and match the snapshot', () => {

app/components/ReposList/tests/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import { IntlProvider } from 'react-intl';
33
import { Provider } from 'react-redux';
4-
import { browserHistory } from 'react-router-dom';
54
import { render } from '@testing-library/react';
65

76
import ReposList from '../index';
87
import configureStore from '../../../configureStore';
8+
import history from '../../../utils/history';
99

1010
describe('<ReposList />', () => {
1111
it('should render the loading indicator when its loading', () => {
@@ -37,7 +37,7 @@ describe('<ReposList />', () => {
3737
};
3838
const store = configureStore(
3939
initialState,
40-
browserHistory,
40+
history,
4141
);
4242
const repos = [
4343
{

app/containers/HomePage/tests/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import React from 'react';
66
import { render, cleanup, fireEvent } from '@testing-library/react';
77
import { IntlProvider } from 'react-intl';
88
import { Provider } from 'react-redux';
9-
import { browserHistory } from 'react-router-dom';
109

1110
import * as appActions from 'containers/App/actions';
1211
import configureStore from '../../../configureStore';
1312
import HomePage from '../index';
1413
import { initialState } from '../reducer';
1514
import { changeUsername } from '../actions';
15+
import history from '../../../utils/history';
1616

1717
jest.mock('containers/App/actions');
1818

@@ -36,7 +36,7 @@ describe('<HomePage />', () => {
3636
});
3737

3838
beforeEach(() => {
39-
store = configureStore({}, browserHistory);
39+
store = configureStore({}, history);
4040
mockedLoadRepos.mockClear();
4141
});
4242

app/containers/LanguageProvider/tests/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import React from 'react';
22
import { render } from '@testing-library/react';
33
import { FormattedMessage, defineMessages } from 'react-intl';
44
import { Provider } from 'react-redux';
5-
import { browserHistory } from 'react-router-dom';
65

76
import LanguageProvider from '../index';
87
import configureStore from '../../../configureStore';
98

109
import { translationMessages } from '../../../i18n';
10+
import history from '../../../utils/history';
1111

1212
const messages = defineMessages({
1313
someMessage: {
@@ -21,7 +21,7 @@ describe('<LanguageProvider />', () => {
2121
let store;
2222

2323
beforeEach(() => {
24-
store = configureStore({}, browserHistory);
24+
store = configureStore({}, history);
2525
});
2626

2727
it('should render its children', () => {

app/containers/LocaleToggle/tests/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import { Provider } from 'react-redux';
3-
import { browserHistory } from 'react-router-dom';
43
import { render, fireEvent } from '@testing-library/react';
54

65
import LocaleToggle from '../index';
@@ -10,6 +9,7 @@ import LanguageProvider from '../../LanguageProvider';
109
import configureStore from '../../../configureStore';
1110
import { translationMessages } from '../../../i18n';
1211
import { action } from 'typesafe-actions';
12+
import history from '../../../utils/history';
1313

1414
jest.mock('../../LanguageProvider/actions');
1515

@@ -22,7 +22,7 @@ describe('<LocaleToggle />', () => {
2222
mockedChangeLocale.mockImplementation(
2323
() => action('test', undefined) as any,
2424
);
25-
store = configureStore({}, browserHistory);
25+
store = configureStore({}, history);
2626
});
2727

2828
it('should match the snapshot', () => {

app/containers/RepoListItem/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import React from 'react';
8-
import { connect, useSelector } from 'react-redux';
8+
import { useSelector } from 'react-redux';
99
import { createStructuredSelector } from 'reselect';
1010
import { FormattedNumber } from 'react-intl';
1111

@@ -15,10 +15,10 @@ import IssueIcon from './IssueIcon';
1515
import IssueLink from './IssueLink';
1616
import RepoLink from './RepoLink';
1717
import Wrapper from './Wrapper';
18-
import { RootState } from 'containers/App/types';
18+
import { Repo } from '../../types/GitHubResponse';
1919

2020
interface OwnProps {
21-
item: any; // Too many fields.
21+
item: Repo;
2222
}
2323

2424
// tslint:disable-next-line:no-empty-interface

app/containers/RepoListItem/tests/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import React from 'react';
66
import { getByText, render } from '@testing-library/react';
77
import { IntlProvider } from 'react-intl';
88
import { Provider } from 'react-redux';
9-
import { browserHistory } from 'react-router-dom';
109

1110
import RepoListItem from '../index';
1211
import configureStore from '../../../configureStore';
12+
import history from '../../../utils/history';
1313

1414
const renderComponent = (item, currentUser) => {
1515
const initialState = {
@@ -23,7 +23,7 @@ const renderComponent = (item, currentUser) => {
2323
},
2424
};
2525
const store = configureStore(
26-
initialState, browserHistory);
26+
initialState, history);
2727

2828
return render(
2929
// tslint:disable-next-line: jsx-wrap-multiline

app/tests/store.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
22
* Test store addons
33
*/
4+
import history from '../utils/history';
45

5-
import { browserHistory } from 'react-router-dom';
66
import configureStore from '../configureStore';
77
import { InjectedStore } from '../types';
88

99
describe('configureStore', () => {
1010
let store: InjectedStore;
1111

1212
beforeAll(() => {
13-
store = configureStore({}, browserHistory);
13+
store = configureStore({}, history);
1414
});
1515

1616
describe('injectedReducers', () => {
@@ -36,7 +36,7 @@ describe('configureStore params', () => {
3636
it('should call window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__', () => {
3737
const compose = jest.fn();
3838
(window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = () => compose;
39-
configureStore(undefined, browserHistory);
39+
configureStore(undefined, history);
4040
expect(compose).toHaveBeenCalled();
4141
});
4242
});

app/types/GitHubResponse.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ReposListForksResponseItem, SearchReposResponseItemsItemOwner } from '@octokit/rest';
2+
3+
interface Owner extends SearchReposResponseItemsItemOwner {
4+
html_url: string;
5+
followers_url: string;
6+
following_url: string;
7+
gists_url: string;
8+
starred_url: string;
9+
subscriptions_url: string;
10+
organizations_url: string;
11+
repos_url: string;
12+
events_url: string;
13+
site_admin: boolean;
14+
15+
}
16+
17+
export interface Repo extends Partial<ReposListForksResponseItem> {
18+
owner: Owner
19+
forks: number;
20+
open_issues: number
21+
watchers: number
22+
}

app/utils/tests/injectReducer.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ describe('injectReducer decorator', () => {
7474
<Provider store={store}>
7575
<ComponentWithReducer {...props} />
7676
</Provider>,
77-
);
77+
)
78+
.getInstance()!;
79+
7880
const {
7981
props: { children },
80-
} = renderedComponent.getInstance();
82+
} = renderedComponent;
8183

8284
expect(children.props).toEqual(props);
8385
});

0 commit comments

Comments
 (0)