Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add platform verification attempt column to verified name history #426

Merged
merged 1 commit into from
Sep 25, 2024
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
26 changes: 25 additions & 1 deletion src/users/VerifiedName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ const verifiedNameHistoryColumns = [
accessor: 'status',
},
{
Header: 'IDV Attempt ID',
Header: 'Legacy Attempt ID',
accessor: 'idvAttemptId',
},
{
Header: 'Proctoring Attempt ID',
accessor: 'proctoringAttemptId',
},
{
Header: 'IDV Attempt ID',
accessor: 'platformVerificationAttemptId',
},
{
Header: 'Created At',
accessor: 'createdAt',
Expand Down Expand Up @@ -105,6 +109,26 @@ export default function VerifiedName({ username }) {
</OverlayTrigger>
) : '',
proctoringAttemptId: result.proctoredExamAttemptId,
platformVerificationAttemptId: result.platformVerificationAttemptId ? (
<OverlayTrigger
placement="right"
trigger="hover"
overlay={(
<Popover id={`${result.platformVerificationAttemptId}-details-tooltip`} aria-hidden="true">
<Popover.Title as="h3">
Status
</Popover.Title>
<Popover.Content data-testid="platformVerificationAttemptTooltipTitle">
{result.platformVerificationAttemptStatus ? result.platformVerificationAttemptStatus : 'Error: Missing data'}
</Popover.Content>
</Popover>
)}
>
<Button variant="link" size="inline">
{result.platformVerificationAttemptId}
</Button>
</OverlayTrigger>
) : '',
createdAt: formatDate(result.created),
}),
), [verifiedNameHistoryData]);
Expand Down
29 changes: 28 additions & 1 deletion src/users/VerifiedName.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Verified Name', () => {

// Profile name and denied verified name are visible in history modal
const profileName = await screen.findAllByText(/jon doe/i);
expect(profileName.length).toEqual(2);
expect(profileName.length).toEqual(3);
await screen.findByText(/j doe/i);
});

Expand Down Expand Up @@ -76,4 +76,31 @@ describe('Verified Name', () => {

expect(screen.getByText('must_retry')).toBeTruthy();
});

it('displays hover popup to show Platform Verification Attempt details', async () => {
const verifiedNameData = {
verifiedName: 'Jonathan Doe',
status: 'approved',
verificationType: 'Proctoring',
history: verifiedNameHistory.results,
};
jest.spyOn(api, 'getVerifiedNameHistory').mockResolvedValueOnce(verifiedNameData);
await act(async () => {
render(<VerifiedNameWrapper {...props} />);
});

const historyButton = await screen.findByText('Show');
await act(async () => {
fireEvent.click(historyButton);
});

const hoverLink = await screen.getByText(verifiedNameHistory.results[2].platform_verification_attempt_id);
await act(async () => {
fireEvent.mouseOver(hoverLink);
});

await screen.getByTestId('platformVerificationAttemptTooltipTitle');

expect(screen.getByText('pending')).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/users/data/test/verifiedNameHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const verifiedNameHistory = {
verification_attempt_id: null,
verification_attempt_status: null,
proctored_exam_attempt_id: 123,
platform_verification_attempt_id: null,
platform_verification_attempt_status: null,
status: 'approved',
},
{
Expand All @@ -16,6 +18,19 @@ const verifiedNameHistory = {
verification_attempt_id: 456,
verification_attempt_status: 'must_retry',
proctored_exam_attempt_id: null,
platform_verification_attempt_id: null,
platform_verification_attempt_status: null,
status: 'denied',
},
{
created: '2021-09-07T17:36:55.781077Z',
verified_name: 'Jonathan D. Doe',
profile_name: 'Jon Doe',
verification_attempt_id: null,
verification_attempt_status: null,
proctored_exam_attempt_id: null,
platform_verification_attempt_id: 789,
platform_verification_attempt_status: 'pending',
status: 'denied',
},
],
Expand Down