forked from wizeline/react-certification-2020
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Mini challenge5 #62
Open
ruth-avelar
wants to merge
7
commits into
wdonet:master
Choose a base branch
from
ruth-avelar:MiniChallenge5
base: master
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
Mini challenge5 #62
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cae6dad
Chellenge 1 Styled Components
ruth-avelar caaea41
Styled Components and videos Challenge1
ruth-avelar 6d87433
Mini-Challenge 2: Intro to Testing
ruth-avelar c847bb6
Mini-Challenge 3: Hooks
ruth-avelar 23a4b1a
Challege 4 useReducer
ruth-avelar ff8dd90
Challenge 5 Routing
ruth-avelar c0547b0
Challenge 5 Routing youYube API
ruth-avelar 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 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 @@ | ||
REACT_APP_API_KEY = AIzaSyCvXyI17JpqteOyWUvL_w7gjwXKOZXnbaI | ||
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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,34 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import AuthProvider from '../providers/Auth/Auth.provider'; | ||
import App from '../components/App'; | ||
|
||
describe('App Components', () => { | ||
it('User name input is present', () => { | ||
render( | ||
<AuthProvider> | ||
<App /> | ||
</AuthProvider> | ||
); | ||
expect(screen.getAllByRole('textbox').length).toBe(1); | ||
}); | ||
|
||
it('App Links are present', () => { | ||
render( | ||
<AuthProvider> | ||
<App /> | ||
</AuthProvider> | ||
); | ||
expect(screen.getAllByRole('link')).toBeTruthy(); | ||
}); | ||
|
||
// it("dataRequested", () => { | ||
|
||
// const action = { | ||
// type: "TOGGLE_THEME", | ||
// payload: { | ||
// state: { currentTheme: "#9999" } | ||
// } | ||
// } | ||
// }); | ||
}); |
This file contains 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,26 @@ | ||
import React from 'react'; | ||
import FavoriteDetail from '../pages/FavoriteVideos/FavoriteVideoDetail.page'; | ||
|
||
describe('FavoriteDetail Components', () => { | ||
const VideoArray = [ | ||
{ | ||
id: { | ||
videoId: '123', | ||
}, | ||
getVideoId: 'cHm3wVzcHjnE', | ||
snippet: { | ||
title: 'rick roll', | ||
thumbnails: { | ||
medium: { | ||
url: 'https://i.ytimg.com/vi/Po3VwR_NNGk/mqdefault.jpg', | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
|
||
it('Take FavoriteDetail Snapshot ', () => { | ||
const component = <FavoriteDetail {...VideoArray} />; | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains 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,26 @@ | ||
import React from 'react'; | ||
import FavoriteVideo from '../pages/FavoriteVideos/FavoriteVideo.page'; | ||
|
||
describe('FavoriteVideo Components', () => { | ||
const VideoArray = [ | ||
{ | ||
id: { | ||
videoId: '123', | ||
}, | ||
getVideoId: 'cHm3wVzcHjnE', | ||
snippet: { | ||
title: 'rick roll', | ||
thumbnails: { | ||
medium: { | ||
url: 'https://i.ytimg.com/vi/Po3VwR_NNGk/mqdefault.jpg', | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
|
||
it('Take FavoriteVideo Snapshot ', () => { | ||
const component = <FavoriteVideo {...VideoArray} />; | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains 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,21 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import AuthProvider from '../providers/Auth/Auth.provider'; | ||
import Fortune from '../components/Fortune'; | ||
|
||
describe('Fortune Components', () => { | ||
it('should take a snapshot', () => { | ||
const { asFragment } = render( | ||
<AuthProvider> | ||
<Fortune /> | ||
</AuthProvider> | ||
); | ||
expect( | ||
asFragment( | ||
<AuthProvider> | ||
<Fortune /> | ||
</AuthProvider> | ||
) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains 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,55 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
import Header from '../components/Header'; | ||
import { AppContext } from '../components/App/App.component'; | ||
|
||
describe('Header Components', () => { | ||
it('should take a snapshot', () => { | ||
const { asFragment } = render( | ||
<Router> | ||
<AppContext.Provider value={false}> | ||
<Header /> | ||
</AppContext.Provider> | ||
</Router> | ||
); | ||
expect(asFragment(<Header />)).toMatchSnapshot(); | ||
}); | ||
|
||
it('Renders a textbox', () => { | ||
// const { debug, getByRole } = render( | ||
const { getByRole } = render( | ||
<Router> | ||
<AppContext.Provider value={false}> | ||
<Header /> | ||
</AppContext.Provider> | ||
</Router> | ||
); | ||
|
||
const searchTextBox = getByRole('textbox'); | ||
expect(searchTextBox).toBeInTheDocument(); | ||
// debug(); | ||
}); | ||
|
||
it('Expect the string Dark Mode', () => { | ||
render( | ||
<Router> | ||
<AppContext.Provider value={false}> | ||
<Header /> | ||
</AppContext.Provider> | ||
</Router> | ||
); | ||
expect(screen.getByText('Dark Mode')).toBeTruthy(); | ||
}); | ||
|
||
it('Toggle element is present in Header', () => { | ||
render( | ||
<Router> | ||
<AppContext.Provider value={false}> | ||
<Header /> | ||
</AppContext.Provider> | ||
</Router> | ||
); | ||
expect(screen.getByRole('checkbox')).toBeTruthy(); | ||
}); | ||
}); |
This file contains 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,37 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import AuthProvider from '../providers/Auth/Auth.provider'; | ||
import WrapperVideo from '../pages/Home/videoContainer'; | ||
|
||
describe('Home Components', () => { | ||
it('should take a snapshot', () => { | ||
const { asFragment } = render( | ||
<AuthProvider> | ||
<BrowserRouter> | ||
<WrapperVideo /> | ||
</BrowserRouter> | ||
</AuthProvider> | ||
); | ||
expect( | ||
asFragment( | ||
<AuthProvider> | ||
<BrowserRouter> | ||
<WrapperVideo /> | ||
</BrowserRouter> | ||
</AuthProvider> | ||
) | ||
).toMatchSnapshot(); | ||
}); | ||
|
||
it('Display img', () => { | ||
render( | ||
<AuthProvider> | ||
<BrowserRouter> | ||
<WrapperVideo /> | ||
</BrowserRouter> | ||
</AuthProvider> | ||
); | ||
expect(screen.getAllByRole('img')).toBeTruthy(); | ||
}); | ||
}); |
This file contains 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,27 @@ | ||
import { renderHook } from '@testing-library/react-hooks'; | ||
import useCallAPI from '../utils/hooks/useCallApi.js'; | ||
|
||
describe('useCallApi', () => { | ||
it('verifies that it renders with no initial value', () => { | ||
const { result } = renderHook(() => useCallAPI(null)); | ||
expect(result.current).toBe(null); | ||
}); | ||
|
||
it('verifies that useCallAPI is defined ', () => { | ||
const { result } = renderHook(() => useCallAPI()); | ||
expect(result.current).toBeDefined(); | ||
}); | ||
|
||
it('should not throw an error', () => { | ||
renderHook(() => useCallAPI()); | ||
}); | ||
|
||
// it('try to call the hook useCallAPI', () => { | ||
// const { result } = renderHook(() => useCallAPI()); | ||
// expect(result.current).toBeFalsy(); | ||
// act(() => { | ||
// result.current | ||
// }) | ||
// expect(result.current).toBeFalsy(); | ||
// }); | ||
}); |
This file contains 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,21 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import AuthProvider from '../providers/Auth/Auth.provider'; | ||
import Layout from '../components/Layout'; | ||
|
||
describe('Layout Components', () => { | ||
it('should take a snapshot', () => { | ||
const { asFragment } = render( | ||
<AuthProvider> | ||
<Layout /> | ||
</AuthProvider> | ||
); | ||
expect( | ||
asFragment( | ||
<AuthProvider> | ||
<Layout /> | ||
</AuthProvider> | ||
) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains 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,40 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import AuthProvider from '../providers/Auth/Auth.provider'; | ||
import Login from '../pages/Login'; | ||
|
||
describe('Login Components', () => { | ||
it('User name input is present', () => { | ||
render( | ||
<AuthProvider> | ||
{' '} | ||
<Login /> | ||
</AuthProvider> | ||
); | ||
expect(screen.getAllByRole('textbox').length).toBe(1); | ||
}); | ||
|
||
it('H1 tag is present', () => { | ||
render( | ||
<AuthProvider> | ||
<Login /> | ||
</AuthProvider> | ||
); | ||
expect(screen.getByText('Welcome back!')).toBeTruthy(); | ||
}); | ||
|
||
it('should take a snapshot', () => { | ||
const { asFragment } = render( | ||
<AuthProvider> | ||
<Login /> | ||
</AuthProvider> | ||
); | ||
expect( | ||
asFragment( | ||
<AuthProvider> | ||
<Login /> | ||
</AuthProvider> | ||
) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains 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,29 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
import ModalFavorite from '../components/ModalFavorite/ModalFavorite.component'; | ||
import { AppContext } from '../components/App/App.component'; | ||
|
||
describe('Modal Favorite Components', () => { | ||
it('should take a snapshot', () => { | ||
const { asFragment } = render( | ||
<Router> | ||
<AppContext.Provider value={false}> | ||
<ModalFavorite /> | ||
</AppContext.Provider> | ||
</Router> | ||
); | ||
expect(asFragment(<ModalFavorite />)).toMatchSnapshot(); | ||
}); | ||
|
||
it('Home Link is present', () => { | ||
render( | ||
<Router> | ||
<AppContext.Provider value={false}> | ||
<ModalFavorite /> | ||
</AppContext.Provider> | ||
</Router> | ||
); | ||
expect(screen.getAllByRole('link')).toBeTruthy(); | ||
}); | ||
}); |
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.
Normally this type of secret needs to be added to the
.gitignore
file for security reasons.