Skip to content

Feat/update packages #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ jobs:
- name: Build
run: yarn build

- name: LHCI Benchmark
run: yarn lhci

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=${{ secrets.SONAR_ORG}}
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# with:
# args: >
# -Dsonar.organization=${{ secrets.SONAR_ORG}}
# -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY}}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
12 changes: 6 additions & 6 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Needed for redux-saga es6 generator support
// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { Router } from 'react-router-dom';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
Expand Down Expand Up @@ -37,9 +37,9 @@ import { translationMessages } from './i18n';
const initialState = {};
const { store, persistor } = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');

const root = createRoot(MOUNT_NODE);
const render = (messages) => {
ReactDOM.render(
root.render(
<ErrorBoundary>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
Expand All @@ -52,8 +52,7 @@ const render = (messages) => {
</LanguageProvider>
</PersistGate>
</Provider>
</ErrorBoundary>,
MOUNT_NODE
</ErrorBoundary>
);
};

Expand All @@ -62,7 +61,8 @@ if (module.hot) {
// modules.hot.accept does not accept dynamic dependencies,
// have to be constants at compile-time
module.hot.accept(['./i18n', 'containers/App'], () => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE);
// ReactDOM.unmountComponentAtNode(MOUNT_NODE);
root.unmount();
render(translationMessages);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ exports[`<Clickable /> component tests should render and match the snapshot 1`]
<body>
<div>
<div
class="Clickable__StyledClickable-sc-19lp5om-0 grlVIv"
class="Clickable__StyledClickable-sc-19lp5om-0 gXlmQJ"
data-testid="clickable"
>
<p
class="T__StyledText-gjlic1-0 kYcyRq"
class="T__StyledText-gjlic1-0 jOByUY"
data-testid="t"
>
Repository List
Expand Down
2 changes: 1 addition & 1 deletion app/components/Clickable/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React from 'react';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { renderWithIntl } from '@utils/testUtils';
import Clickable from '../index';

Expand Down
6 changes: 3 additions & 3 deletions app/components/Header/tests/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ exports[`<Header /> should render and match the snapshot 1`] = `
<body>
<div>
<header
class="ant-layout-header Header__StyledHeader-wp2jxc-0 jpfWFm"
class="ant-layout-header Header__StyledHeader-wp2jxc-0 kCacbk"
data-testid="header"
intl="[object Object]"
>
<img
alt="logo"
class="Header__Logo-wp2jxc-1 bDHyGP"
class="Header__Logo-wp2jxc-1 exNzgN"
src="IMAGE_MOCK"
/>
<p
class="T__StyledText-gjlic1-0 kYTaGb Header__Title-wp2jxc-2 cqzBIP"
class="T__StyledText-gjlic1-0 guBozt Header__Title-wp2jxc-2 OSRax"
data-testid="t"
>
Wednesday Solutions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ exports[`<ProtectedRoute /> should render and match the snapshot 1`] = `
<body>
<div>
<div
class="HomeContainer__Container-l0s8pp-1 haKSMo"
class="HomeContainer__Container-l0s8pp-1 iQEnjC"
>
<div
class="HomeContainer__RightContent-l0s8pp-2 bvlZvV"
class="HomeContainer__RightContent-l0s8pp-2 iWJscD"
>
<p
class="T__StyledText-gjlic1-0 kYcyRq HomeContainer__StyledT-l0s8pp-3 fYCmLU"
class="T__StyledText-gjlic1-0 jOByUY HomeContainer__StyledT-l0s8pp-3 iOEXgS"
data-testid="redirect"
>
Go to Storybook
</p>
</div>
<div
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 kPJcqJ"
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 liNnZz css-dev-only-do-not-override-jy3e2f"
maxwidth="500"
>
<div
Expand All @@ -37,19 +37,19 @@ exports[`<ProtectedRoute /> should render and match the snapshot 1`] = `
class="ant-card-body"
>
<p
class="T__StyledText-gjlic1-0 demndm"
class="T__StyledText-gjlic1-0 gGweRc"
data-testid="t"
>
Get details of repositories
</p>
<span
class="ant-input-group-wrapper ant-input-search"
class="ant-input-group-wrapper ant-input-search css-dev-only-do-not-override-jy3e2f"
>
<span
class="ant-input-wrapper ant-input-group"
class="ant-input-wrapper ant-input-group css-dev-only-do-not-override-jy3e2f"
>
<input
class="ant-input"
class="ant-input css-dev-only-do-not-override-jy3e2f"
data-testid="search-bar"
type="text"
value=""
Expand All @@ -58,7 +58,7 @@ exports[`<ProtectedRoute /> should render and match the snapshot 1`] = `
class="ant-input-group-addon"
>
<button
class="ant-btn ant-btn-icon-only ant-input-search-button"
class="ant-btn css-dev-only-do-not-override-jy3e2f ant-btn-default ant-btn-icon-only ant-input-search-button"
type="button"
>
<span
Expand Down Expand Up @@ -87,7 +87,7 @@ exports[`<ProtectedRoute /> should render and match the snapshot 1`] = `
</div>
</div>
<div
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 gkbTPT"
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 fCikHd css-dev-only-do-not-override-jy3e2f"
color="grey"
>
<div
Expand All @@ -107,7 +107,7 @@ exports[`<ProtectedRoute /> should render and match the snapshot 1`] = `
class="ant-card-body"
>
<p
class="T__StyledText-gjlic1-0 kYcyRq"
class="T__StyledText-gjlic1-0 jOByUY"
data-testid="default-message"
>
Search for a repository by entering it's name in the search box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ exports[`<RepoCard /> should render and match the snapshot 1`] = `
<body>
<div>
<div
class="ant-card ant-card-bordered RepoCard__CustomCard-sc-3wf6pv-0 iiVuom"
class="ant-card ant-card-bordered RepoCard__CustomCard-sc-3wf6pv-0 hBtxvU css-dev-only-do-not-override-jy3e2f"
data-testid="repo-card"
>
<div
class="ant-card-body"
>
<p
class="T__StyledText-gjlic1-0 kYcyRq"
class="T__StyledText-gjlic1-0 jOByUY"
data-testid="name-unavailable"
>
Repository name is unavailable
</p>
<p
class="T__StyledText-gjlic1-0 kYcyRq"
class="T__StyledText-gjlic1-0 jOByUY"
data-testid="fullName-unavailable"
>
Repository full name unavaiable
</p>
<p
class="T__StyledText-gjlic1-0 kYcyRq"
class="T__StyledText-gjlic1-0 jOByUY"
data-testid="stargazers-unavaiable"
>
Repository stars are unavaiable
Expand Down
2 changes: 1 addition & 1 deletion app/components/T/tests/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`<T /> component tests should render and match the snapshot 1`] = `
<body>
<div>
<p
class="T__StyledText-gjlic1-0 kYcyRq"
class="T__StyledText-gjlic1-0 jOByUY"
data-testid="t"
/>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/containers/App/tests/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
exports[`<App /> container tests should render and match the snapshot 1`] = `
<div>
<header
class="ant-layout-header Header__StyledHeader-wp2jxc-0 jpfWFm"
class="ant-layout-header Header__StyledHeader-wp2jxc-0 kCacbk"
data-testid="header"
intl="[object Object]"
>
<img
alt="logo"
class="Header__Logo-wp2jxc-1 bDHyGP"
class="Header__Logo-wp2jxc-1 exNzgN"
src="IMAGE_MOCK"
/>
<p
class="T__StyledText-gjlic1-0 kYTaGb Header__Title-wp2jxc-2 cqzBIP"
class="T__StyledText-gjlic1-0 guBozt Header__Title-wp2jxc-2 OSRax"
data-testid="t"
>
Wednesday Solutions
Expand Down
22 changes: 11 additions & 11 deletions app/containers/HomeContainer/tests/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ exports[`<HomeContainer /> tests should render and match the snapshot 1`] = `
<body>
<div>
<div
class="HomeContainer__Container-l0s8pp-1 haKSMo"
class="HomeContainer__Container-l0s8pp-1 iQEnjC"
>
<div
class="HomeContainer__RightContent-l0s8pp-2 bvlZvV"
class="HomeContainer__RightContent-l0s8pp-2 iWJscD"
>
<p
class="T__StyledText-gjlic1-0 kYcyRq HomeContainer__StyledT-l0s8pp-3 fYCmLU"
class="T__StyledText-gjlic1-0 jOByUY HomeContainer__StyledT-l0s8pp-3 iOEXgS"
data-testid="redirect"
>
Go to Storybook
</p>
</div>
<div
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 kPJcqJ"
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 liNnZz css-dev-only-do-not-override-jy3e2f"
maxwidth="500"
>
<div
Expand All @@ -37,19 +37,19 @@ exports[`<HomeContainer /> tests should render and match the snapshot 1`] = `
class="ant-card-body"
>
<p
class="T__StyledText-gjlic1-0 demndm"
class="T__StyledText-gjlic1-0 gGweRc"
data-testid="t"
>
Get details of repositories
</p>
<span
class="ant-input-group-wrapper ant-input-search"
class="ant-input-group-wrapper ant-input-search css-dev-only-do-not-override-jy3e2f"
>
<span
class="ant-input-wrapper ant-input-group"
class="ant-input-wrapper ant-input-group css-dev-only-do-not-override-jy3e2f"
>
<input
class="ant-input"
class="ant-input css-dev-only-do-not-override-jy3e2f"
data-testid="search-bar"
type="text"
value=""
Expand All @@ -58,7 +58,7 @@ exports[`<HomeContainer /> tests should render and match the snapshot 1`] = `
class="ant-input-group-addon"
>
<button
class="ant-btn ant-btn-icon-only ant-input-search-button"
class="ant-btn css-dev-only-do-not-override-jy3e2f ant-btn-default ant-btn-icon-only ant-input-search-button"
type="button"
>
<span
Expand Down Expand Up @@ -87,7 +87,7 @@ exports[`<HomeContainer /> tests should render and match the snapshot 1`] = `
</div>
</div>
<div
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 gkbTPT"
class="ant-card ant-card-bordered HomeContainer__CustomCard-l0s8pp-0 fCikHd css-dev-only-do-not-override-jy3e2f"
color="grey"
>
<div
Expand All @@ -107,7 +107,7 @@ exports[`<HomeContainer /> tests should render and match the snapshot 1`] = `
class="ant-card-body"
>
<p
class="T__StyledText-gjlic1-0 kYcyRq"
class="T__StyledText-gjlic1-0 jOByUY"
data-testid="default-message"
>
Search for a repository by entering it's name in the search box
Expand Down
2 changes: 1 addition & 1 deletion app/containers/LanguageProvider/tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-testing-library';
import { render } from '@testing-library/react';
import { FormattedMessage, defineMessages } from 'react-intl';
import { Provider } from 'react-redux';
import { browserHistory } from 'react-router-dom';
Expand Down
2 changes: 1 addition & 1 deletion app/containers/NotFoundPage/tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-testing-library';
import { render } from '@testing-library/react';
import { IntlProvider } from 'react-intl';

import NotFoundPage from '../index';
Expand Down
6 changes: 5 additions & 1 deletion app/utils/apiUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { create } from 'apisauce';
import axios from 'axios';
import axiosRetry from 'axios-retry';
import snakeCase from 'lodash/snakeCase';
import camelCase from 'lodash/camelCase';
import { mapKeysDeep } from './index';
Expand All @@ -20,10 +22,12 @@ export const generateApiClient = (type = 'github') => {
};

export const createApiClientWithTransForm = (baseURL) => {
const api = create({
const customAxiosInstance = axios.create({
baseURL,
headers: { 'Content-Type': 'application/json' }
});
const api = create({ axiosInstance: customAxiosInstance });
axiosRetry(customAxiosInstance, { retries: 3 });
api.addResponseTransform((response) => {
const { ok, data } = response;
if (ok && data) {
Expand Down
9 changes: 3 additions & 6 deletions jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@
"@app(.*)$": "<rootDir>/app/$1",
"@(containers|components|services|utils|themes)(.*)$": "<rootDir>/app/$1/$2",
".*\\.(css|less|styl|scss|sass)$": "<rootDir>/internals/mocks/cssModule.js",
".*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/image.js"
".*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/image.js",
"^axios$": "axios/dist/node/axios.cjs"
},
"setupFilesAfterEnv": [
"<rootDir>/jest.setup.js",
"<rootDir>/internals/testing/test-bundler.js",
"react-testing-library/cleanup-after-each"
],
"setupFilesAfterEnv": ["<rootDir>/jest.setup.js", "<rootDir>/internals/testing/test-bundler.js"],
"setupFiles": ["raf/polyfill"],
"testRegex": "tests/.*\\.test\\.js$",
"snapshotSerializers": []
Expand Down
Loading