Skip to content

Commit 9c8d215

Browse files
committed
Fix tests
1 parent 89ea621 commit 9c8d215

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

frontend/__tests__/unit/pages/About.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ describe('About Component', () => {
197197
expect(screen.queryByText('Contributor 10')).not.toBeInTheDocument()
198198
})
199199

200-
201200
const showMoreButton = screen.getByRole('button', { name: /Show more/i })
202201
fireEvent.click(showMoreButton)
203202

frontend/__tests__/unit/pages/ProjectDetails.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,15 @@ describe('ProjectDetailsPage', () => {
103103
expect(screen.queryByText('Contributor 10')).not.toBeInTheDocument()
104104
})
105105

106-
const contributorsSection = screen.getByTestId('top-contributors')
107-
108-
const showMoreButton = within(contributorsSection!).getByRole('button', { name: /Show more/i })
106+
const showMoreButton = screen.getByRole('button', { name: /Show more/i })
109107
fireEvent.click(showMoreButton)
110108

111109
await waitFor(() => {
112110
expect(screen.getByText('Contributor 7')).toBeInTheDocument()
113111
expect(screen.getByText('Contributor 8')).toBeInTheDocument()
114112
})
115113

116-
const showLessButton = within(contributorsSection!).getByRole('button', { name: /Show less/i })
114+
const showLessButton = screen.getByRole('button', { name: /Show less/i })
117115
fireEvent.click(showLessButton)
118116

119117
await waitFor(() => {

frontend/__tests__/unit/pages/RepositoryDetails.test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useQuery } from '@apollo/client'
22
import { addToast } from '@heroui/toast'
3-
import { act, fireEvent, screen, waitFor, within } from '@testing-library/react'
3+
import { act, fireEvent, screen, waitFor } from '@testing-library/react'
44
import { mockRepositoryData } from '@unit/data/mockRepositoryData'
55
import { render } from 'wrappers/testUtil'
66
import RepositoryDetailsPage from 'app/organizations/[organizationKey]/repositories/[repositoryKey]/page'
@@ -105,17 +105,15 @@ describe('RepositoryDetailsPage', () => {
105105
expect(screen.queryByText('Contributor 10')).not.toBeInTheDocument()
106106
})
107107

108-
const contributorsSection = screen.getByTestId('top-contributors')
109-
110-
const showMoreButton = within(contributorsSection!).getByRole('button', { name: /Show more/i })
108+
const showMoreButton = screen.getByRole('button', { name: /Show more/i })
111109
fireEvent.click(showMoreButton)
112110

113111
await waitFor(() => {
114112
expect(screen.getByText('Contributor 7')).toBeInTheDocument()
115113
expect(screen.getByText('Contributor 8')).toBeInTheDocument()
116114
})
117115

118-
const showLessButton = within(contributorsSection!).getByRole('button', { name: /Show less/i })
116+
const showLessButton = screen.getByRole('button', { name: /Show less/i })
119117
fireEvent.click(showLessButton)
120118

121119
await waitFor(() => {

frontend/src/components/AnchorTitle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const AnchorTitle: React.FC<AnchorTitleProps> = ({ href, title }) => {
4747

4848
return (
4949
<div id={id} className="relative">
50-
<div className="items-center group relative flex">
50+
<div className="group relative flex items-center">
5151
<h2 className="flex items-center text-2xl font-semibold">{title}</h2>
5252
<a
5353
href={href}

frontend/src/components/TopContributors.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ const TopContributors = ({
4949
>
5050
<div className="grid gap-4 sm:grid-cols-1 md:grid-cols-3">
5151
{displayContributors.map((item, index) => (
52-
<div
53-
key={index}
54-
className="overflow-hidden rounded-lg bg-gray-200 p-4 dark:bg-gray-700"
55-
>
52+
<div key={index} className="overflow-hidden rounded-lg bg-gray-200 p-4 dark:bg-gray-700">
5653
<div className="flex w-full flex-col justify-between">
5754
<div className="flex w-full items-center gap-2">
5855
<Image
@@ -74,8 +71,7 @@ const TopContributors = ({
7471
{isContributor ? (
7572
<span className="overflow-hidden text-ellipsis whitespace-nowrap text-gray-600 dark:text-gray-400">
7673
{' '}
77-
{item.contributionsCount}{' '}
78-
{pluralize(item.contributionsCount, 'contribution')}
74+
{item.contributionsCount} {pluralize(item.contributionsCount, 'contribution')}
7975
</span>
8076
) : (
8177
<Link

0 commit comments

Comments
 (0)