From 77088c0affd46e695168f10364b06a2a6cc43f88 Mon Sep 17 00:00:00 2001 From: Alie Langston Date: Wed, 25 Sep 2024 14:56:41 -0400 Subject: [PATCH] feat: add platform verification attempt column to verified name history --- src/users/VerifiedName.jsx | 27 +++++++++++++++++++- src/users/VerifiedName.test.jsx | 29 +++++++++++++++++++++- src/users/data/test/verifiedNameHistory.js | 15 +++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/users/VerifiedName.jsx b/src/users/VerifiedName.jsx index 093db4e5c..94bfb39c2 100644 --- a/src/users/VerifiedName.jsx +++ b/src/users/VerifiedName.jsx @@ -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', @@ -69,6 +73,7 @@ export default function VerifiedName({ username }) { await getVerifiedNameHistory(username).then((data) => { if (isMounted) { const camelCaseData = camelCaseObject(data); + console.log(camelCaseData); setVerifiedNameData(camelCaseData); } }); @@ -105,6 +110,26 @@ export default function VerifiedName({ username }) { ) : '', proctoringAttemptId: result.proctoredExamAttemptId, + platformVerificationAttemptId: result.platformVerificationAttemptId ? ( + + ) : '', createdAt: formatDate(result.created), }), ), [verifiedNameHistoryData]); diff --git a/src/users/VerifiedName.test.jsx b/src/users/VerifiedName.test.jsx index 31c9b148a..a6bbb6389 100644 --- a/src/users/VerifiedName.test.jsx +++ b/src/users/VerifiedName.test.jsx @@ -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); }); @@ -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(); + }); + + 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(); + }); }); diff --git a/src/users/data/test/verifiedNameHistory.js b/src/users/data/test/verifiedNameHistory.js index 236360a26..fee781369 100644 --- a/src/users/data/test/verifiedNameHistory.js +++ b/src/users/data/test/verifiedNameHistory.js @@ -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', }, { @@ -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', }, ],