Skip to content

Commit

Permalink
fix: PullCoverage a passing null instead of boolean (#3679)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov authored Jan 24, 2025
1 parent b7ce614 commit 9a77add
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ vi.mock('./routes/ComponentsTab', () => ({
default: () => <div>ComponentsTab</div>,
}))

const mockPullData = (resultType) => {
const mockPullData = (resultType: string) => {
if (resultType !== ComparisonReturnType.SUCCESSFUL_COMPARISON) {
return {
owner: {
Expand Down Expand Up @@ -181,7 +181,9 @@ const queryClientV5 = new QueryClientV5({
})

const wrapper =
(initialEntries = '/gh/codecov/test-repo/pull/1') =>
(
initialEntries = '/gh/codecov/test-repo/pull/1'
): React.FC<React.PropsWithChildren> =>
({ children }) => (
<QueryClientProviderV5 client={queryClientV5}>
<QueryClientProvider client={queryClient}>
Expand Down Expand Up @@ -213,6 +215,14 @@ afterAll(() => {
server.close()
})

interface SetupArgs {
resultType?: string
isTeamPlan?: boolean
bundleAnalysisEnabled?: boolean
coverageEnabled?: boolean
isGithubRateLimited?: boolean
}

describe('PullRequestPageContent', () => {
function setup(
{
Expand All @@ -221,7 +231,7 @@ describe('PullRequestPageContent', () => {
bundleAnalysisEnabled = false,
coverageEnabled = false,
isGithubRateLimited = false,
} = {
}: SetupArgs = {
resultType: ComparisonReturnType.SUCCESSFUL_COMPARISON,
isTeamPlan: false,
bundleAnalysisEnabled: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ const Loader = () => (
</div>
)

interface URLParams {
owner: string
repo: string
pullId: string
provider: string
}

function PullCoverageContent() {
const { owner, repo, pullId, provider } = useParams()
const { owner, repo, pullId, provider } = useParams<URLParams>()
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })

Expand Down Expand Up @@ -123,7 +130,7 @@ function PullCoverageContent() {
}

function PullCoverage() {
const { owner, repo, pullId, provider } = useParams()
const { owner, repo, pullId, provider } = useParams<URLParams>()
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })
const { data: rateLimit } = useRepoRateLimitStatus({ provider, owner, repo })
Expand All @@ -134,7 +141,7 @@ function PullCoverage() {
owner,
repo,
pullId,
isTeamPlan: isTeamPlan && overview?.private,
isTeamPlan: (isTeamPlan && overview?.private) ?? false,
})
)

Expand Down

0 comments on commit 9a77add

Please sign in to comment.