diff --git a/server/src/main/resources/db/dev/R__Load_testing_data.sql b/server/src/main/resources/db/dev/R__Load_testing_data.sql index 4693bf5fd1..8c0ada2f68 100644 --- a/server/src/main/resources/db/dev/R__Load_testing_data.sql +++ b/server/src/main/resources/db/dev/R__Load_testing_data.sql @@ -1699,9 +1699,19 @@ VALUES ('d27b679c-3aa8-4c4d-b08e-4eda63cea23f', '105f2968-a182-45a3-892c-eeff76383fe0', '06c03df3-85fe-4fc3-979e-9f1f6ba74a03', '5', '2022-08-01'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('39dfd281-d0af-4016-848b-8156dfef2b92', PGP_SYM_ENCRYPT('Kudos to Revolver Ocelot!', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2022-10-01', '2022-10-02'); +('39dfd281-d0af-4016-848b-8156dfef2b93', PGP_SYM_ENCRYPT('Kudos to Revolver Ocelot!', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2023-12-01', '2023-12-02', true); + +INSERT INTO kudos_recipient +(id, kudosid, memberid) +VALUES +('ebc023e1-b577-4b02-a2fb-fc9472a8474b', '39dfd281-d0af-4016-848b-8156dfef2b93', '105f2968-a182-45a3-892c-eeff76383fe0'); + +INSERT INTO kudos +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) +VALUES +('39dfd281-d0af-4016-848b-8156dfef2b92', PGP_SYM_ENCRYPT('Kudos to Revolver Ocelot!', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2022-10-01', null, true); INSERT INTO kudos_recipient (id, kudosid, memberid) @@ -1709,9 +1719,9 @@ VALUES ('ebc023e1-b577-4b02-a2fb-fc9472a8474a', '39dfd281-d0af-4016-848b-8156dfef2b92', '105f2968-a182-45a3-892c-eeff76383fe0'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('fbcde196-7703-4f80-ac5e-5ac60b28555e', PGP_SYM_ENCRYPT('Kudos to Huey and Awesome!', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2022-10-01', null); +('fbcde196-7703-4f80-ac5e-5ac60b28555e', PGP_SYM_ENCRYPT('Kudos to Huey and Awesome!', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2024-10-21', '2024-10-21', true); INSERT INTO kudos_recipient (id, kudosid, memberid) @@ -1724,9 +1734,9 @@ VALUES ('bf37c244-f478-42b2-9077-dd4cb052bbb1', 'fbcde196-7703-4f80-ac5e-5ac60b28555e', '67dc3a3b-5bfa-4759-997a-fb6bac98dcf3'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('df2766f0-efab-4925-859e-d993e2e38eaa', PGP_SYM_ENCRYPT('Kudos to the Checkins Experts team!', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', 'a8733740-cf4c-4c16-a8cf-4f928c409acc', '2022-09-28', '2022-09-29'); +('df2766f0-efab-4925-859e-d993e2e38eaa', PGP_SYM_ENCRYPT('Kudos to the Checkins Experts team!', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', 'a8733740-cf4c-4c16-a8cf-4f928c409acc', '2024-09-28', '2024-09-29', true); INSERT INTO kudos_recipient (id, kudosid, memberid) @@ -1744,9 +1754,9 @@ VALUES ('0ca86d55-cffb-4b84-883c-c4c2e41eff73', 'df2766f0-efab-4925-859e-d993e2e38eaa', '67dc3a3b-5bfa-4759-997a-fb6bac98dcf3'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('17e19f16-d731-4242-a74a-43493a556f08', PGP_SYM_ENCRYPT('Kudos to Michael Kimberlin!', '${aeskey}'), 'a90be358-aa3d-49c8-945a-879a93646e45', null, '2022-08-15', '2022-08-25'); +('17e19f16-d731-4242-a74a-43493a556f08', PGP_SYM_ENCRYPT('Kudos to Mischievous Kangaroo!', '${aeskey}'), 'a90be358-aa3d-49c8-945a-879a93646e45', null, '2024-11-01', null, true); INSERT INTO kudos_recipient (id, kudosid, memberid) @@ -1754,9 +1764,9 @@ VALUES ('038485ee-8cac-416b-9da6-d838ee345d0e', '17e19f16-d731-4242-a74a-43493a556f08', 'e4b2fe52-1915-4544-83c5-21b8f871f6db'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('6612b8a0-1d45-4155-b0fb-e0b2d9eaafcb', PGP_SYM_ENCRYPT('Wanted to give some kudos to Mischievous Kangaroo and Revolver Ocelot for their recent help on the project. Thank you very much!', '${aeskey}'), '1b4f99da-ef70-4a76-9b37-8bb783b749ad', null, '2022-10-05', null); +('6612b8a0-1d45-4155-b0fb-e0b2d9eaafcb', PGP_SYM_ENCRYPT('Wanted to give some kudos to Mischievous Kangaroo and Revolver Ocelot for their recent help on the project. Thank you very much!', '${aeskey}'), '1b4f99da-ef70-4a76-9b37-8bb783b749ad', null, '2024-10-29', '2024-10-29', true); INSERT INTO kudos_recipient (id, kudosid, memberid) @@ -1769,9 +1779,9 @@ VALUES ('01f639d5-b7b3-47a2-b165-d7a20d01fec2', '6612b8a0-1d45-4155-b0fb-e0b2d9eaafcb', '105f2968-a182-45a3-892c-eeff76383fe0'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('9cdce399-4c02-41ed-a63f-35beb6ecb622', PGP_SYM_ENCRYPT('A huge thank you to the Javascript Gurus team for offering their advice on the tech stack for the new project. Kudos to you all!', '${aeskey}'), '8d75c07e-6adc-437a-8659-7dd953ce6600', 'e8f052a8-40b5-4fb4-9bab-8b16ed36adc7', '2022-10-10', '2022-10-11'); +('9cdce399-4c02-41ed-a63f-35beb6ecb622', PGP_SYM_ENCRYPT('A huge thank you to the Javascript Gurus team for offering their advice on the tech stack for the new project. Kudos to you all!', '${aeskey}'), '8d75c07e-6adc-437a-8659-7dd953ce6600', 'e8f052a8-40b5-4fb4-9bab-8b16ed36adc7', '2022-10-10', '2022-10-11', true); INSERT INTO kudos_recipient (id, kudosid, memberid) @@ -1789,9 +1799,9 @@ VALUES ('f792056b-22ce-4e3d-a442-0fdc3cb35e7b', '9cdce399-4c02-41ed-a63f-35beb6ecb622', '105f2968-a182-45a3-892c-eeff76383fe0'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('39dfd284-d0bf-4017-848c-8156dfef2b93', PGP_SYM_ENCRYPT('Kudos are tasty.', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2024-09-04', '2022-09-04'); +('39dfd284-d0bf-4017-848c-8156dfef2b93', PGP_SYM_ENCRYPT('Kudos are tasty.', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2024-11-10', '2024-11-10', true); INSERT INTO kudos_recipient (id, kudosid, memberid) @@ -1799,9 +1809,9 @@ VALUES ('ebc023e2-b578-4b03-a2fc-fc9472a8474b', '39dfd284-d0bf-4017-848c-8156dfef2b93', 'c7406157-a38f-4d48-aaed-04018d846727'); INSERT INTO kudos -(id, message, senderid, teamid, datecreated, dateapproved) +(id, message, senderid, teamid, datecreated, dateapproved, publiclyvisible) VALUES -('39dfd284-d0bf-4017-848c-8156dfef2b94', PGP_SYM_ENCRYPT('Kudos are covered in chocolate.', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2024-09-04', '2022-09-04'); +('39dfd284-d0bf-4017-848c-8156dfef2b94', PGP_SYM_ENCRYPT('Kudos are covered in chocolate.', '${aeskey}'), 'e4b2fe52-1915-4544-83c5-21b8f871f6db', null, '2024-09-04', '2022-09-04', true); INSERT INTO kudos_recipient (id, kudosid, memberid) diff --git a/web-ui/src/components/certifications/EarnedCertificationsTable.jsx b/web-ui/src/components/certifications/EarnedCertificationsTable.jsx index a13b67e8ad..814a62ec85 100644 --- a/web-ui/src/components/certifications/EarnedCertificationsTable.jsx +++ b/web-ui/src/components/certifications/EarnedCertificationsTable.jsx @@ -94,7 +94,7 @@ const EarnedCertificationsTable = ({ }); if (res.error) return; - const certs = res.payload.data; + const certs = res.payload.data ?? []; setCertifications(certs.sort((c1, c2) => c1.name.localeCompare(c2.name))); const certMap = certs.reduce((map, cert) => { @@ -114,7 +114,7 @@ const EarnedCertificationsTable = ({ }); if (res.error) return; - let earned = res.payload.data; + let earned = res.payload.data ?? []; if (onlyMe) { earned = earned.filter(cert => cert.memberId === currentUser.id); } @@ -512,7 +512,7 @@ const EarnedCertificationsTable = ({ }); if (res.error) return; - const newEarned = res.payload.data; + const newEarned = res.payload.data ?? []; setEarnedCertifications(earned => { if (id) { const index = earned.findIndex(c => c.id === id); diff --git a/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx b/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx index 0cce738fa0..9ae46e2cc2 100644 --- a/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx +++ b/web-ui/src/components/feedback_submit_form/FeedbackSubmitForm.jsx @@ -175,7 +175,7 @@ const FeedbackSubmitForm = ({ type: UPDATE_TOAST, payload: { severity: 'error', - toast: res.error + toast: res?.error ?? 'Unknown Error' } }); } @@ -188,21 +188,10 @@ const FeedbackSubmitForm = ({ ) : ( - + {isReviewing ? 'Reviewing' : 'Submitting'} Feedback on{' '} {requesteeName} -{/* {!isReviewing && ( */} -{/*
*/} -{/* */} -{/* info-icon */} -{/* */} -{/* */} -{/* Tip of the day: */} -{/* {tip} */} -{/* */} -{/*
*/} -{/* )} */} {!isReviewing && ( Notice! diff --git a/web-ui/src/components/reviews/TeamMemberReview.jsx b/web-ui/src/components/reviews/TeamMemberReview.jsx index d22bec0b88..d87bc5515e 100644 --- a/web-ui/src/components/reviews/TeamMemberReview.jsx +++ b/web-ui/src/components/reviews/TeamMemberReview.jsx @@ -131,6 +131,7 @@ const TeamMemberReview = ({ : 'Self-Review' } {...a11yProps(0)} + key={0} /> {reviews && reviews.filter(r => !!r).map((review, index) => { @@ -148,7 +149,10 @@ const TeamMemberReview = ({ } return ( - + ); })} @@ -158,7 +162,7 @@ const TeamMemberReview = ({ index={value} onChangeIndex={handleChangeIndex} > - + {selfReview?.id ? ( + { : aName.localeCompare(b.name)); }) .map((period) => ( -
+
{ + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/components/volunteer/__snapshots__/VolunteerTables.test.jsx.snap b/web-ui/src/components/volunteer/__snapshots__/VolunteerTables.test.jsx.snap new file mode 100644 index 0000000000..91bfa13eb8 --- /dev/null +++ b/web-ui/src/components/volunteer/__snapshots__/VolunteerTables.test.jsx.snap @@ -0,0 +1,168 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`renders correctly 1`] = ` +
+
+
+
+
+
+ + +
+ +
+
+
+
+
+
+ + + + + + + + + + + +
+ Member + 🔼 + + Organization + + Start Date + + End Date + + Actions +
+
+

+ The administrator may edit organizations to ensure accuracy. +

+
+
+
+ +
+
+`; diff --git a/web-ui/src/pages/CertificationReportPage.test.jsx b/web-ui/src/pages/CertificationReportPage.test.jsx new file mode 100644 index 0000000000..1e821f18a8 --- /dev/null +++ b/web-ui/src/pages/CertificationReportPage.test.jsx @@ -0,0 +1,34 @@ +import React from 'react'; +import CertificationReportPage from './CertificationReportPage'; +import { AppContextProvider } from '../context/AppContext'; +import { BrowserRouter } from 'react-router-dom'; + +const userStateWithPermission = { + state: { + userProfile: { + name: 'Mitch Hedberg', + role: ['MEMBER'], + permissions: [{ permission: 'CAN_MANAGE_EARNED_CERTIFICATIONS' }], + } + } +}; + +it('renders correctly', () => { + snapshot( + + + + + + ); +}); + +it('renders an error if user does not have appropriate permission', () => { + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/pages/CheckinsReportPage.test.jsx b/web-ui/src/pages/CheckinsReportPage.test.jsx new file mode 100644 index 0000000000..4299d33188 --- /dev/null +++ b/web-ui/src/pages/CheckinsReportPage.test.jsx @@ -0,0 +1,35 @@ +import React from 'react'; +import CheckinsReportPage from './CheckinsReportPage'; +import { AppContextProvider } from '../context/AppContext'; +import { BrowserRouter } from 'react-router-dom'; + +const userStateWithPermission = { + state: { + userProfile: { + name: 'Mitch Hedberg', + role: ['MEMBER'], + permissions: [{ permission: 'CAN_VIEW_CHECKINS_REPORT' }], + }, + terminatedMembers: [], + } +}; + +it('renders correctly', () => { + snapshot( + + + + + + ); +}); + +it('renders an error if user does not have appropriate permission', () => { + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/pages/EmailPage.test.jsx b/web-ui/src/pages/EmailPage.test.jsx new file mode 100644 index 0000000000..7ee3c50bf2 --- /dev/null +++ b/web-ui/src/pages/EmailPage.test.jsx @@ -0,0 +1,37 @@ +import React from 'react'; +import EmailPage from './EmailPage'; +import { AppContextProvider } from '../context/AppContext'; +import { BrowserRouter } from 'react-router-dom'; + +window.scrollTo = vi.fn(); + +const userStateWithPermission = { + state: { + userProfile: { + name: 'Mitch Hedberg', + role: ['MEMBER'], + permissions: [{ permission: 'CAN_SEND_EMAIL' }], + }, + terminatedMembers: [], + } +}; + +it('renders correctly', () => { + snapshot( + + + + + + ); +}); + +it('renders an error if user does not have appropriate permission', () => { + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/pages/FeedbackSubmitPage.jsx b/web-ui/src/pages/FeedbackSubmitPage.jsx index a0edf36de4..4475dcb3fc 100644 --- a/web-ui/src/pages/FeedbackSubmitPage.jsx +++ b/web-ui/src/pages/FeedbackSubmitPage.jsx @@ -169,7 +169,7 @@ const FeedbackSubmitPage = () => { }, [currentUserId, feedbackRequest, selfReviewRequest, state]); return ( - + {requestCanceled ? ( This feedback request has been canceled. diff --git a/web-ui/src/pages/FeedbackSubmitPage.test.jsx b/web-ui/src/pages/FeedbackSubmitPage.test.jsx new file mode 100644 index 0000000000..40fe4ac292 --- /dev/null +++ b/web-ui/src/pages/FeedbackSubmitPage.test.jsx @@ -0,0 +1,88 @@ +import React from 'react'; +import FeedbackSubmitPage from './FeedbackSubmitPage'; +import { AppContextProvider } from '../context/AppContext'; +import { http, HttpResponse } from 'msw'; +import { setupServer } from 'msw/node'; +import { MemoryRouter } from 'react-router-dom'; + +window.snackDispatch = vi.fn(); + +const userProfile = { + id: 'member-id', + name: 'Mitch Hedberg', + role: ['MEMBER'], + workEmail: 'hedbergm@objectcomputing.com', + title: 'Strategic Placement Specialist', + location: 'Roseville, Minnesota', + memberProfile: { + id: 'member-id', + bioText: 'Died too young.', + }, +}; + +const userStateWithPermission = { + state: { + csrf: 'csrf', + userProfile: userProfile, + teams: [], + memberProfiles: [ + { + id: 'some-id', + name: 'James Johnson', + }, + userProfile, + ], + }, + dispatch: vi.fn(), +}; + +const server = setupServer( + http.get('http://localhost:8080/services/feedback/requests/request-id', ({ request }) => { + return HttpResponse.json( + { + 'id': 'request-id', + 'status': 'SUBMITTED', + 'requesteeId': userStateWithPermission.state.memberProfiles[0].id, + 'recipientId': userStateWithPermission.state.memberProfiles[1].id, + }, + ); + }), + http.get('http://localhost:8080/services/feedback/requests/canceled-request-id', ({ request }) => { + return HttpResponse.json( + { + 'id': 'canceled-request-id', + 'status': 'CANCELED', + 'requesteeId': userStateWithPermission.state.memberProfiles[0].id, + 'recipientId': userStateWithPermission.state.memberProfiles[1].id, + }, + ); + }), +); + +beforeAll(() => server.listen({ onUnhandledRequest(request, print) {} })); +afterEach(() => server.resetHandlers()); +afterAll(() => server.close()); + +it('renders correctly - submitted', async () => { + await waitForSnapshot( + 'request-id', + + + + + + ); +}); + +it('renders correctly - canceled', async () => { + await waitForSnapshot( + 'canceled-request-id', + + + + + + ); +}); diff --git a/web-ui/src/pages/ManageKudosPage.jsx b/web-ui/src/pages/ManageKudosPage.jsx index e495efb5f9..8b9473a08f 100644 --- a/web-ui/src/pages/ManageKudosPage.jsx +++ b/web-ui/src/pages/ManageKudosPage.jsx @@ -63,6 +63,20 @@ const ManageKudosPage = () => { const [approvedKudosLoading, setApprovedKudosLoading] = useState(true); const [kudosTab, setKudosTab] = useState("PENDING"); const [timeRange, setTimeRange] = useState(DateRange.TWO_WEEKS); + const [pendingSort, setPendingSort] = useState(SortOption.OLDEST); + + const sortPendingKudos = (pending) => { + return pending.sort((a, b) => { + const l = pendingSort === SortOption.NEWEST ? a : b; + const r = pendingSort === SortOption.NEWEST ? b : a; + for(let i = 0; i < l.dateCreated.length; i++) { + if (l.dateCreated[i] != r.dateCreated[i]) { + return r.dateCreated[i] - l.dateCreated[i]; + } + } + return 0; + }); + }; const loadPendingKudos = useCallback(async () => { setPendingKudosLoading(true); @@ -85,17 +99,21 @@ const ManageKudosPage = () => { useEffect(() => { loadPendingKudos().then(data => { if (data) { - setPendingKudos(data); + setPendingKudos(sortPendingKudos(data)); } }); }, [csrf, dispatch, loadPendingKudos]); + useEffect(() => { + setPendingKudos(sortPendingKudos([...pendingKudos])); + }, [pendingSort]); + const handleTabChange = useCallback((event, newTab) => { switch (newTab) { case "PENDING": loadPendingKudos().then(data => { if (data) { - setPendingKudos(data); + setPendingKudos(sortPendingKudos(data)); } }); break; @@ -113,6 +131,33 @@ const ManageKudosPage = () => { setKudosTab(newTab); }, [loadPendingKudos, loadApprovedKudos]); + const filterApprovedKudos = (kudos) => { + if (!kudos.dateApproved) { + return false; + } + + const now = new Date(); + const approved = new Date(kudos.dateApproved[0], + kudos.dateApproved[1] - 1, + kudos.dateApproved[2]).getTime(); + switch(timeRange) { + case DateRange.ONE_WEEK: + return approved >= (new Date(now.getFullYear(), now.getMonth(), + now.getDate() - 7).getTime()); + case DateRange.TWO_WEEKS: + return approved >= (new Date(now.getFullYear(), now.getMonth(), + now.getDate() - 14).getTime()); + case DateRange.ONE_MONTH: + return approved >= (new Date(now.getFullYear(), now.getMonth() - 1, + now.getDate()).getTime()); + case DateRange.ONE_YEAR: + return approved >= (new Date(now.getFullYear() - 1, now.getMonth(), + now.getDate()).getTime()); + case DateRange.ALL_TIME: + return true; + } + }; + return selectHasAdministerKudosPermission(state) ? ( @@ -141,6 +186,8 @@ const ManageKudosPage = () => { select label="Sort by" variant="outlined" + value={pendingSort} + onChange={(event) => setPendingSort(event.target.value)} > Newest Oldest @@ -176,7 +223,7 @@ const ManageKudosPage = () => { ? Array.from({length: 5}).map((_, index) => ) : (
- {approvedKudos.map(k => + {approvedKudos.filter(filterApprovedKudos).map(k => )}
diff --git a/web-ui/src/pages/MeritReportPage.jsx b/web-ui/src/pages/MeritReportPage.jsx index 6a4225b279..dde1ff7dd3 100644 --- a/web-ui/src/pages/MeritReportPage.jsx +++ b/web-ui/src/pages/MeritReportPage.jsx @@ -81,7 +81,8 @@ const MeritReportPage = () => { if (data) { let periods = data.reduce((result, item) => { if (item.closeDate) { - result.push({label: formatReviewDate(item.closeDate), + result.push({label: item.name + ' - ' + + formatReviewDate(item.closeDate), id: item.id}); } return result; @@ -552,6 +553,7 @@ const MeritReportPage = () => { option.label || ""} value={reviewPeriodId} onChange={onReviewPeriodChange} renderInput={params => ( diff --git a/web-ui/src/pages/MeritReportPage.test.jsx b/web-ui/src/pages/MeritReportPage.test.jsx new file mode 100644 index 0000000000..0012ead967 --- /dev/null +++ b/web-ui/src/pages/MeritReportPage.test.jsx @@ -0,0 +1,34 @@ +import React from 'react'; +import MeritReportPage from './MeritReportPage'; +import { AppContextProvider } from '../context/AppContext'; +import { BrowserRouter } from 'react-router-dom'; + +const userStateWithPermission = { + state: { + userProfile: { + name: 'Mitch Hedberg', + role: ['MEMBER'], + permissions: [{ permission: 'CAN_CREATE_MERIT_REPORT' }], + } + } +}; + +it('renders correctly', () => { + snapshot( + + + + + + ); +}); + +it('renders an error if user does not have appropriate permission', () => { + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/pages/ProfilePage.test.jsx b/web-ui/src/pages/ProfilePage.test.jsx new file mode 100644 index 0000000000..a5ef9e2caf --- /dev/null +++ b/web-ui/src/pages/ProfilePage.test.jsx @@ -0,0 +1,34 @@ +import React from 'react'; +import ProfilePage from './ProfilePage'; +import { AppContextProvider } from '../context/AppContext'; +import { BrowserRouter } from 'react-router-dom'; + +const userProfile = { + id: 'member-id', + name: 'Mitch Hedberg', + role: ['MEMBER'], + workEmail: 'hedbergm@objectcomputing.com', + title: 'Strategic Placement Specialist', + location: 'Roseville, Minnesota', + memberProfile: { + id: 'member-id', + bioText: 'Died too young.', + }, +}; + +const userStateWithPermission = { + state: { + memberProfiles: [ userProfile ], + userProfile: userProfile, + } +}; + +it('renders correctly', () => { + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/pages/ReceivedRequestsPage.test.jsx b/web-ui/src/pages/ReceivedRequestsPage.test.jsx new file mode 100644 index 0000000000..e8aae91492 --- /dev/null +++ b/web-ui/src/pages/ReceivedRequestsPage.test.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import ReceivedRequestsPage from './ReceivedRequestsPage'; +import { AppContextProvider } from '../context/AppContext'; +import { BrowserRouter } from 'react-router-dom'; + + +const initialState = { + state: { + userProfile: { + name: 'Mitch Hedberg', + role: ['MEMBER'], + }, + }, +}; + +it('renders correctly', () => { + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/pages/ReviewsPage.test.jsx b/web-ui/src/pages/ReviewsPage.test.jsx new file mode 100644 index 0000000000..be95217b18 --- /dev/null +++ b/web-ui/src/pages/ReviewsPage.test.jsx @@ -0,0 +1,38 @@ +import React from 'react'; +import ReviewsPage from './ReviewsPage'; +import { AppContextProvider } from '../context/AppContext'; +import { BrowserRouter } from 'react-router-dom'; + +window.snackDispatch = vi.fn(); + +const initialState = { + state: { + userProfile: { + name: 'Mitch Hedberg', + role: ['MEMBER'], + }, + // Review Period 2 should be listed before Review Period 1 because it's OPEN + reviewPeriods: [ + { + id: 'a44fc66a-86b0-4f15-8459-e7d4b4ecc330', + name: 'Review Period 1', + reviewStatus: 'CLOSED', + }, + { + id: 'a44fc66a-86b0-4f15-8459-e7d4b4ecc331', + name: 'Review Period 2', + reviewStatus: 'OPEN', + }, + ], + }, +}; + +it('renders correctly', () => { + snapshot( + + + + + + ); +}); diff --git a/web-ui/src/pages/__snapshots__/CertificationReportPage.test.jsx.snap b/web-ui/src/pages/__snapshots__/CertificationReportPage.test.jsx.snap new file mode 100644 index 0000000000..3aa7fb840a --- /dev/null +++ b/web-ui/src/pages/__snapshots__/CertificationReportPage.test.jsx.snap @@ -0,0 +1,145 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`renders an error if user does not have appropriate permission 1`] = ` +
+

+ You do not have permission to view this page. +

+
+`; + +exports[`renders correctly 1`] = ` +
+
+ +
+
+
+
+
+ +
+
+
+

+ Earned Certifications +

+
+
+
+
+ + + + + + + + + + + + + + +
+ Member + 🔼 + + Name + + Description + + Earned On + + Expiration + + Validation Image + + Badge + + Actions +
+ +
+
+
+
+
+
+`; diff --git a/web-ui/src/pages/__snapshots__/CheckinsReportPage.test.jsx.snap b/web-ui/src/pages/__snapshots__/CheckinsReportPage.test.jsx.snap new file mode 100644 index 0000000000..9553f57e44 --- /dev/null +++ b/web-ui/src/pages/__snapshots__/CheckinsReportPage.test.jsx.snap @@ -0,0 +1,218 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`renders an error if user does not have appropriate permission 1`] = ` +
+

+ You do not have permission to view this page. +

+
+`; + +exports[`renders correctly 1`] = ` +
+
+
+
+
+ +
+
+ Select PDLs +
+
+ ( + 0 + ) +
+
+
+
+
+
+ + + + +
+
+
+
+
+
+ +
+ + Q4 2024 + +
+ +
+
+
+
+ Start of Quarter +
+
+ Tue Oct 01 2024 +
+
+
+
+ End of Quarter +
+
+ Tue Dec 31 2024 +
+
+
+
+
+
+

+ No PDLs selected +

+

+ Please select some PDLs using the Member Selector. +

+
+
+
+
+`; diff --git a/web-ui/src/pages/__snapshots__/EmailPage.test.jsx.snap b/web-ui/src/pages/__snapshots__/EmailPage.test.jsx.snap new file mode 100644 index 0000000000..94d95652a9 --- /dev/null +++ b/web-ui/src/pages/__snapshots__/EmailPage.test.jsx.snap @@ -0,0 +1,305 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`renders an error if user does not have appropriate permission 1`] = ` +
+

+ You do not have permission to view this page. +

+
+`; + +exports[`renders correctly 1`] = ` +
+ +
+`; diff --git a/web-ui/src/pages/__snapshots__/FeedbackSubmitPage.test.jsx.snap b/web-ui/src/pages/__snapshots__/FeedbackSubmitPage.test.jsx.snap new file mode 100644 index 0000000000..bc9357ff5f --- /dev/null +++ b/web-ui/src/pages/__snapshots__/FeedbackSubmitPage.test.jsx.snap @@ -0,0 +1,143 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`renders correctly - canceled 1`] = ` +
+ +
+`; + +exports[`renders correctly - submitted 1`] = ` +
+ +
+`; diff --git a/web-ui/src/pages/__snapshots__/MeritReportPage.test.jsx.snap b/web-ui/src/pages/__snapshots__/MeritReportPage.test.jsx.snap new file mode 100644 index 0000000000..470a70b25a --- /dev/null +++ b/web-ui/src/pages/__snapshots__/MeritReportPage.test.jsx.snap @@ -0,0 +1,277 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`renders an error if user does not have appropriate permission 1`] = ` +
+

+ You do not have permission to view this page. +

+
+`; + +exports[`renders correctly 1`] = ` +
+
+ + + +
+ +
+
+
+
+ +
+
+ Selected Members +
+
+ ( + 0 + ) +
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ +
+ +
+ + +
+ +
+
+
+
+ +
+
+`; diff --git a/web-ui/src/pages/__snapshots__/ProfilePage.test.jsx.snap b/web-ui/src/pages/__snapshots__/ProfilePage.test.jsx.snap new file mode 100644 index 0000000000..257c38b7cf --- /dev/null +++ b/web-ui/src/pages/__snapshots__/ProfilePage.test.jsx.snap @@ -0,0 +1,746 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`renders correctly 1`] = ` +
+
+
+
+ Profile +
+
+
+
+
+ +
+
+

+ Mitch Hedberg +

+

+ Strategic Placement Specialist +

+
+
+

+ + hedbergm@objectcomputing.com + +
+ Location: + Roseville, Minnesota +
+ Supervisor: +
+ Current PDL: +
+

+
+
+
+
+
+
+
+
+
+ +
+
+
+

+ Bio +

+
+
+
+
+
+ +