Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/apps/review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ sudo yarn start
- Canonical `PLACEMENT` winner types are shown. Untyped and contest-submission winner types remain
supported for legacy challenge records, while checkpoint winner types are excluded.
- Checkpoint winners remain separate from final placements and are identified by member ID in the
Checkpoint Review table.
Checkpoint Review table. The winner indicator appears only on rows that passed Checkpoint Review.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable import/no-extraneous-dependencies, ordered-imports/ordered-imports */
import type { PropsWithChildren, ReactNode } from 'react'
import { render, screen } from '@testing-library/react'
import { render, screen, within } from '@testing-library/react'

import {
ChallengeDetailContext,
Expand Down Expand Up @@ -160,6 +160,14 @@ const secondWinnerRow = {
submissionId: 'second-winner-submission',
} as Screening

const failedWinnerRow = {
...winnerRow,
result: 'NO PASS',
reviewId: 'failed-winner-review',
score: '0.00',
submissionId: 'failed-winner-submission',
} as Screening

const challengeInfo = {
checkpointWinners: [{
handle: 'checkpointWinner',
Expand Down Expand Up @@ -202,7 +210,7 @@ const reviewAppContext = {
} as ReviewAppContextModel

/**
* Renders the desktop checkpoint review table with two winner rows and one non-winner.
* Renders the desktop checkpoint review table with passing, failing, and non-winner rows.
*
* @returns The Testing Library render result for the checkpoint table.
* @throws This test helper does not throw.
Expand All @@ -212,7 +220,7 @@ function renderCheckpointTable(): ReturnType<typeof render> {
<ReviewAppContext.Provider value={reviewAppContext}>
<ChallengeDetailContext.Provider value={challengeContext}>
<TableCheckpointSubmissions
datas={[winnerRow, secondWinnerRow, nonWinnerRow]}
datas={[winnerRow, secondWinnerRow, failedWinnerRow, nonWinnerRow]}
downloadSubmission={jest.fn()}
isDownloading={{}}
mode='review'
Expand All @@ -223,7 +231,7 @@ function renderCheckpointTable(): ReturnType<typeof render> {
}

describe('TableCheckpointSubmissions checkpoint winner indicator', () => {
it('marks only rows whose member id matches a checkpoint winner', () => {
it('marks only passing rows whose member id matches a checkpoint winner', () => {
renderCheckpointTable()

expect(screen.getAllByRole('button', { name: 'Checkpoint winner details' }))
Expand All @@ -241,6 +249,12 @@ describe('TableCheckpointSubmissions checkpoint winner indicator', () => {
.toHaveLength(2)
expect(screen.getByText('100.00'))
.toBeTruthy()
const failedScoreCell = screen.getByRole('link', { name: '0.00' }).parentElement
expect(failedScoreCell)
.toBeTruthy()
expect(within(failedScoreCell as HTMLElement)
.queryByRole('button', { name: 'Checkpoint winner details' }))
.toBeNull()
expect(screen.getByRole('link', { name: '88.89' })
.getAttribute('href'))
.toBe('./../reviews/non-winner-submission?reviewId=non-winner-review')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,8 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => {
renderer: (data: Screening) => {
const reviewId = data.reviewId
const scoreLabel = data.score ?? 'Pending'
const isCheckpointWinner = checkpointWinnerMemberIds.has(`${data.memberId}`)
const isCheckpointWinner = data.result === 'PASS'
&& checkpointWinnerMemberIds.has(`${data.memberId}`)

return (
<span className={styles.scoreCell}>
Expand Down
Loading