Skip to content

Commit 9a77add

Browse files
authored
fix: PullCoverage a passing null instead of boolean (#3679)
1 parent b7ce614 commit 9a77add

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

src/pages/PullRequestPage/PullCoverage/PullCoverage.test.jsx renamed to src/pages/PullRequestPage/PullCoverage/PullCoverage.test.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ vi.mock('./routes/ComponentsTab', () => ({
4444
default: () => <div>ComponentsTab</div>,
4545
}))
4646

47-
const mockPullData = (resultType) => {
47+
const mockPullData = (resultType: string) => {
4848
if (resultType !== ComparisonReturnType.SUCCESSFUL_COMPARISON) {
4949
return {
5050
owner: {
@@ -181,7 +181,9 @@ const queryClientV5 = new QueryClientV5({
181181
})
182182

183183
const wrapper =
184-
(initialEntries = '/gh/codecov/test-repo/pull/1') =>
184+
(
185+
initialEntries = '/gh/codecov/test-repo/pull/1'
186+
): React.FC<React.PropsWithChildren> =>
185187
({ children }) => (
186188
<QueryClientProviderV5 client={queryClientV5}>
187189
<QueryClientProvider client={queryClient}>
@@ -213,6 +215,14 @@ afterAll(() => {
213215
server.close()
214216
})
215217

218+
interface SetupArgs {
219+
resultType?: string
220+
isTeamPlan?: boolean
221+
bundleAnalysisEnabled?: boolean
222+
coverageEnabled?: boolean
223+
isGithubRateLimited?: boolean
224+
}
225+
216226
describe('PullRequestPageContent', () => {
217227
function setup(
218228
{
@@ -221,7 +231,7 @@ describe('PullRequestPageContent', () => {
221231
bundleAnalysisEnabled = false,
222232
coverageEnabled = false,
223233
isGithubRateLimited = false,
224-
} = {
234+
}: SetupArgs = {
225235
resultType: ComparisonReturnType.SUCCESSFUL_COMPARISON,
226236
isTeamPlan: false,
227237
bundleAnalysisEnabled: false,

src/pages/PullRequestPage/PullCoverage/PullCoverage.jsx renamed to src/pages/PullRequestPage/PullCoverage/PullCoverage.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@ const Loader = () => (
3434
</div>
3535
)
3636

37+
interface URLParams {
38+
owner: string
39+
repo: string
40+
pullId: string
41+
provider: string
42+
}
43+
3744
function PullCoverageContent() {
38-
const { owner, repo, pullId, provider } = useParams()
45+
const { owner, repo, pullId, provider } = useParams<URLParams>()
3946
const { data: overview } = useRepoOverview({ provider, owner, repo })
4047
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })
4148

@@ -123,7 +130,7 @@ function PullCoverageContent() {
123130
}
124131

125132
function PullCoverage() {
126-
const { owner, repo, pullId, provider } = useParams()
133+
const { owner, repo, pullId, provider } = useParams<URLParams>()
127134
const { data: overview } = useRepoOverview({ provider, owner, repo })
128135
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })
129136
const { data: rateLimit } = useRepoRateLimitStatus({ provider, owner, repo })
@@ -134,7 +141,7 @@ function PullCoverage() {
134141
owner,
135142
repo,
136143
pullId,
137-
isTeamPlan: isTeamPlan && overview?.private,
144+
isTeamPlan: (isTeamPlan && overview?.private) ?? false,
138145
})
139146
)
140147

0 commit comments

Comments
 (0)