-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6fa000
commit fe9e663
Showing
11 changed files
with
118 additions
and
39 deletions.
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 |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# Solution to Vinted FE Code Challenge | ||
|
||
[Assignment Instructions](https://gist.github.com/vintedEngineering/c838e906ecc25a52fe91c4a8a11e2916) | ||
### Requirements | ||
|
||
- [x] Leverage [Flickr API](https://www.flickr.com/services/api/flickr.photos.getRecent.html) | ||
- [x] Design should be recreated as closely as possible. | ||
- [x] Responsive design with three breakpoints for Desktop, Tablet, Phone. | ||
- [x] Infinite scroll. | ||
- [x] Keep liked photo data persistent with page reload. | ||
- [x] Use React | ||
- [x] No External libraries beside React | ||
|
||
[Full Assignment Instructions](https://gist.github.com/vintedEngineering/c838e906ecc25a52fe91c4a8a11e2916) | ||
|
||
[Demo](https://maxie-max.github.io/vinted-fe-code-challenge/) | ||
|
||
### 🛠 To install dependencies run | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
### 🏗 To run app in the development mode | ||
|
||
``` | ||
npm start | ||
``` | ||
|
||
### 👩🔬 Testing | ||
|
||
Test suite is setup with [Jest](https://jestjs.io) and [react-testing-library](https://github.com/kentcdodds/react-testing-library). | ||
|
||
To run all tests: | ||
|
||
```bash | ||
npm test | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ | |
"devDependencies": { | ||
"gh-pages": "^3.2.0" | ||
} | ||
} | ||
} |
This file was deleted.
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
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 { render, fireEvent, cleanup } from '@testing-library/react' | ||
import Button from '../Button' | ||
|
||
const defaultProps = { | ||
label: 'Like', | ||
handleLike: jest.fn(), | ||
} | ||
|
||
test('button renders with correct label', () => { | ||
const { queryByText, rerender } = render(<Button {...defaultProps} />) | ||
expect(queryByText('Like')).toBeTruthy() | ||
|
||
// Change props | ||
rerender(<Button {...defaultProps} label='Dislike' />) | ||
expect(queryByText('Dislike')).toBeTruthy() | ||
}) | ||
|
||
test('calls correct function on click', () => { | ||
const { handleLike, label } = defaultProps | ||
const { getByText } = render( | ||
<Button {...defaultProps} onClick={handleLike} /> | ||
) | ||
fireEvent.click(getByText(label)) | ||
expect(handleLike).toHaveBeenCalled() | ||
}) |
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,14 @@ | ||
import React from 'react' | ||
import { render, fireEvent, waitFor, cleanup } from '@testing-library/react' | ||
import List from '../List' | ||
|
||
afterEach(cleanup) | ||
|
||
test('should not render List on start', () => { | ||
const { queryByTestId } = render(<List />) | ||
expect(queryByTestId('fetch-list')).toBeNull() | ||
}) | ||
test('should show Loader on start', () => { | ||
const { queryByTestId } = render(<List />) | ||
expect(queryByTestId('loader').textContent).toBe('Fetching photos ...') | ||
}) |
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