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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`<ProtectedRoute /> should render and match the snapshot 1`] = `
</p>
</div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-19cof65-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-12lr87k-MuiPaper-root-MuiCard-root"
maxwidth="500"
>
<div
Expand Down Expand Up @@ -95,7 +95,7 @@ exports[`<ProtectedRoute /> should render and match the snapshot 1`] = `
</div>
</div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-18bnhwu-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-1veibbr-MuiPaper-root-MuiCard-root"
color="grey"
>
<div
Expand Down
2 changes: 1 addition & 1 deletion app/components/RepoCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function RepoCard({ name, fullName, stargazersCount }) {
>
<T data-testid="fullName" id="repository_full_name" values={{ fullName }} />
</If>
<If condition={stargazersCount} otherwise={<T data-testid="stargazers-unavaiable" id="repo_stars_unavailable" />}>
<If condition={stargazersCount || stargazersCount === 0} otherwise={<T data-testid="stargazers-unavailable" id="repo_stars_unavailable" />}>
<T data-testid="stargazers" id="repository_stars" values={{ stars: stargazersCount }} />
</If>
</CustomCard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ exports[`<RepoCard /> should render and match the snapshot 1`] = `
class="css-lh9t18 egtqi0h0"
data-testid="fullName-unavailable"
>
Repository full name unavaiable
Repository full name unavailable
</p>
<p
class="css-lh9t18 egtqi0h0"
data-testid="stargazers-unavaiable"
data-testid="stargazers-unavailable"
>
Repository stars are unavaiable
Repository stars are unavailable
</p>
</div>
</div>
Expand Down
12 changes: 11 additions & 1 deletion app/components/RepoCard/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@ describe('<RepoCard />', () => {
expect(getByTestId('stargazers')).toHaveTextContent(stargazersCount);
});

it('should show the star count even when it is 0', () => {
const repoName = 'react-template';
const fullName = 'wednesday-solutions/react-template';
const stargazersCount = 0;
const { getByTestId } = renderWithIntl(
<RepoCard name={repoName} fullName={fullName} stargazersCount={stargazersCount} />
);
expect(getByTestId('stargazers')).toHaveTextContent(stargazersCount.toString());
});

it('should render the repository unavailable messages in case any props are unavailable or have falsy values', () => {
const repoUnavailable = translate('repo_name_unavailable');
const fullNameUnavailable = translate('repo_full_name_unavailable');
const stargazersUnavailable = translate('repo_stars_unavailable');
const { getByTestId } = renderWithIntl(<RepoCard />);
expect(getByTestId('name-unavailable')).toHaveTextContent(repoUnavailable);
expect(getByTestId('fullName-unavailable')).toHaveTextContent(fullNameUnavailable);
expect(getByTestId('stargazers-unavaiable')).toHaveTextContent(stargazersUnavailable);
expect(getByTestId('stargazers-unavailable')).toHaveTextContent(stargazersUnavailable);
});
});
3 changes: 1 addition & 2 deletions app/containers/HomeContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const CustomCard = styled(Card)`
&& {
margin: 1.25rem 0;
padding: 1rem;
max-width: ${(props) => props.maxwidth};
color: ${(props) => props.color};
max-width: ${(props) => props.maxwidth}px;
${(props) => props.color && `color: ${props.color}`};
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`<HomeContainer /> tests should render and match the snapshot 1`] = `
</p>
</div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-19cof65-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-12lr87k-MuiPaper-root-MuiCard-root"
maxwidth="500"
>
<div
Expand Down Expand Up @@ -95,7 +95,7 @@ exports[`<HomeContainer /> tests should render and match the snapshot 1`] = `
</div>
</div>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-18bnhwu-MuiPaper-root-MuiCard-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root e666d1v5 css-1veibbr-MuiPaper-root-MuiCard-root"
color="grey"
>
<div
Expand Down
2 changes: 1 addition & 1 deletion app/translations/en.js

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

4 changes: 2 additions & 2 deletions app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"get_repo_details": "Get details of repositories",
"matching_repos": "Total number of matching repos: {totalCount}",
"not_found_page_container": "This is the NotFoundPage container!",
"repo_full_name_unavailable": "Repository full name unavaiable",
"repo_full_name_unavailable": "Repository full name unavailable",
"repo_list": "Repository List",
"repo_name_unavailable": "Repository name is unavailable",
"repo_search": "Repository Search",
"repo_search_default": "Search for a repository by entering it's name in the search box",
"repo_stars_unavailable": "Repository stars are unavaiable",
"repo_stars_unavailable": "Repository stars are unavailable",
"repository_full_name": "Repository full name: {fullName}",
"repository_name": "Repository Name: {name}",
"repository_stars": "Repository stars: {stars}",
Expand Down
Loading