Skip to content
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea/*
target/*
ci-tdd-java-template.iml

19 changes: 19 additions & 0 deletions .idea/$PRODUCT_WORKSPACE_FILE$

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/sonarIssues.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
17 changes: 17 additions & 0 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions ci-tdd-java-template.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="sonarModuleSettings">
<option name="localAnalysisScripName" value="&lt;PROJECT&gt;" />
<option name="serverName" value="&lt;PROJECT&gt;" />
</component>
</module>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test"
"test": "react-scripts test",
"prettier": "prettier"
},
"dependencies": {
"abort-controller": "3.0.0",
Expand Down
14 changes: 10 additions & 4 deletions src/App/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,21 @@ it('shows a search box and calls the service when entering some text', async ()
expect(searchInput).toHaveValue(initialSearchText);

await wait(() => {
expect(searchPhotosSpy).toHaveBeenLastCalledWith(initialSearchText);
expect(searchPhotosSpy).toHaveBeenLastCalledWith(
initialSearchText,
expect.anything(),
);
});

fireEvent.change(searchInput, {
target: { value: newSearchText },
});

await wait(() => {
expect(searchPhotosSpy).toHaveBeenLastCalledWith(newSearchText);
expect(searchPhotosSpy).toHaveBeenLastCalledWith(
newSearchText,
expect.anything(),
);
});
});

Expand All @@ -89,6 +95,6 @@ it('fetches and displays images', async () => {
const { url, width, height } = mockPhoto.sizes[0];

expect(imageElement).toHaveAttribute('src', url);
expect(imageElement).toHaveAttribute('width', width);
expect(imageElement).toHaveAttribute('height', height);
expect(imageElement).toHaveAttribute('width', width.toString());
expect(imageElement).toHaveAttribute('height', height.toString());
});
40 changes: 25 additions & 15 deletions src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,30 @@ export default function App() {
);

return (
<header className={classes.header}>
<img src={logo} className={classes.logo} alt="logo" />
<p>
Edit <code className={classes.code}>src/App.tsx</code> and save to
reload.
</p>
<a
className={classes.link}
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<div>
{error && <div role="alert">Oh no!</div>}
<div>
{loading
? 'Loading'
: photos.length < 1
? 'No images found'
: photos.map(el => (
<img
key={el.id}
alt={el.title}
src={el.sizes[0].url}
width={el.sizes[0].width}
height={el.sizes[0].height}
/>
))}
</div>
<label htmlFor="search">Search</label>
<input
type="search"
id="search"
value={query}
onChange={e => setQuery(e.target.value)}
/>
</div>
);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.