-
Notifications
You must be signed in to change notification settings - Fork 0
React capstone project - Metrics webapp #4
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
porag-m06
wants to merge
12
commits into
development
Choose a base branch
from
style-test-setup
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0e275fc
style and tests added
porag-m06 adaa16b
test & readme.md file update
porag-m06 b1cf805
update live demo link
porag-m06 dd3ef52
update
porag-m06 b1c1c4f
update geolocation link to https link
porag-m06 e2dafe1
console log removed
porag-m06 4b742f1
live deploy issue fixed & updated live deploy link to readme.md
porag-m06 6b07c5c
link protocol update'
porag-m06 6fb1979
link protocol update'
porag-m06 0178c8b
link protocol update final
porag-m06 f53a6f5
style update
porag-m06 09ddf2b
linter issue fixed
porag-m06 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import '@testing-library/jest-dom'; | ||
| import React from 'react'; | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { Provider } from 'react-redux'; | ||
| import { BrowserRouter } from 'react-router-dom'; | ||
| import configureStore from 'redux-mock-store'; | ||
| import thunk from 'redux-thunk'; | ||
| import GeoLocation from '../components/GeoLocation'; | ||
|
|
||
| const middlewares = [thunk]; | ||
| const mockStore = configureStore(middlewares); | ||
|
|
||
| describe('GeoLocation component', () => { | ||
| let store; | ||
|
|
||
| beforeEach(() => { | ||
| store = mockStore({ | ||
| geolocation: { | ||
| locations: [], | ||
| isLoading: false, | ||
| error: undefined, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| test('GEOLOCATION TEST 1: renders loading message when data is being fetched', () => { | ||
| store = mockStore({ | ||
| geolocation: { | ||
| locations: [], | ||
| isLoading: true, | ||
| error: undefined, | ||
| }, | ||
| }); | ||
|
|
||
| render( | ||
| <Provider store={store}> | ||
| <BrowserRouter> | ||
| <GeoLocation /> | ||
| </BrowserRouter> | ||
| </Provider>, | ||
| ); | ||
|
|
||
| expect(screen.getByText('geoLocations data is loading...')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test('GEOLOCATION TEST 2: renders error message when data fetch fails', async () => { | ||
| store = mockStore({ | ||
| geolocation: { | ||
| locations: [], | ||
| isLoading: false, | ||
| error: 'Something went wrong', | ||
| }, | ||
| }); | ||
|
|
||
| render( | ||
| <Provider store={store}> | ||
| <BrowserRouter> | ||
| <GeoLocation /> | ||
| </BrowserRouter> | ||
| </Provider>, | ||
| ); | ||
|
|
||
| expect(screen.getByText('Something went wrong...!')).toBeInTheDocument(); | ||
| }); | ||
| }); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import '@testing-library/jest-dom'; | ||
| import React from 'react'; | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { Provider } from 'react-redux'; | ||
| import { BrowserRouter } from 'react-router-dom'; | ||
| import configureStore from 'redux-mock-store'; | ||
| import thunk from 'redux-thunk'; | ||
| import PollutionDetail from '../components/PollutionDetail'; | ||
|
|
||
| const middlewares = [thunk]; | ||
| const mockStore = configureStore(middlewares); | ||
|
|
||
| describe('PollutionDetail component', () => { | ||
| let store; | ||
|
|
||
| beforeEach(() => { | ||
| store = mockStore({ | ||
| airpollution: { | ||
| list: [], | ||
| isLoading: false, | ||
| error: undefined, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| test('POLLUTIONDETAILS TEST 1: renders loading message when data is being fetched', () => { | ||
| store = mockStore({ | ||
| airpollution: { | ||
| list: [], | ||
| isLoading: true, | ||
| error: undefined, | ||
| }, | ||
| }); | ||
|
|
||
| render( | ||
| <Provider store={store}> | ||
| <BrowserRouter> | ||
| <PollutionDetail /> | ||
| </BrowserRouter> | ||
| </Provider>, | ||
| ); | ||
|
|
||
| expect(screen.getByText('airpollution data is loading...')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test('POLLUTIONDETAILS TEST 2: renders error message when data fetch fails', () => { | ||
| store = mockStore({ | ||
| airpollution: { | ||
| list: [], | ||
| isLoading: false, | ||
| error: 'Something went wrong', | ||
| }, | ||
| }); | ||
|
|
||
| render( | ||
| <Provider store={store}> | ||
| <BrowserRouter> | ||
| <PollutionDetail /> | ||
| </BrowserRouter> | ||
| </Provider>, | ||
| ); | ||
|
|
||
| expect(screen.getByText('Something went wrong...!')).toBeInTheDocument(); | ||
| }); | ||
| }); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redux/features/geolocations/geolocationSlice.jsfile. I would like to suggest that you delete the commented code on line49, this is because commented code makes a project look unprofessional and is widely considered as a sign of code that is not clean. Please see the screenshot below and rectify this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the feedback. It has been removed. :)