From 165085ca5b17a4eb562b49eadc3adcf7257ad1bf Mon Sep 17 00:00:00 2001 From: Nicholas Summers Date: Thu, 13 Jun 2024 09:05:28 -0400 Subject: [PATCH] Add branching test case for getEligbleWorkplan --- .../ui-src/src/utils/reports/reports.test.ts | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/services/ui-src/src/utils/reports/reports.test.ts b/services/ui-src/src/utils/reports/reports.test.ts index 64590ea19..1a0893c5a 100644 --- a/services/ui-src/src/utils/reports/reports.test.ts +++ b/services/ui-src/src/utils/reports/reports.test.ts @@ -40,12 +40,26 @@ describe("Test getEligbleWorkplan function", () => { it("should grab the oldest eligble workplan", async () => { const submissions: ReportMetadataShape[] = [ { + submissionName: "New Jersey Work Plan 2023 - Period 2", + dueDate: convertDateEtToUtc("11/01/2023"), + lastAlteredBy: "Anthony Soprano", reportType: "WP", + reportPeriod: 2, + createdAt: 1699496227241, + reportYear: 2023, + lastAltered: 1699496227241, state: "NJ", - id: "2Xv4Me4q00ztl41PakEf7nxGPtp", - submissionName: "New Jersey Work Plan 2023 - Period 2", + id: "too-new", + locked: false, status: ReportStatus.APPROVED, - createdAt: 1699496172798, + }, + { + reportType: "WP", + state: "NJ", + id: "just-right", + submissionName: "New Jersey Work Plan 2023 - Period 1", + status: ReportStatus.APPROVED, + createdAt: 1699496130000, lastAltered: 1699496172798, lastAlteredBy: "Anthony Soprano", dueDate: convertDateEtToUtc("11/01/2023"), @@ -54,22 +68,22 @@ describe("Test getEligbleWorkplan function", () => { locked: false, }, { - submissionName: "New Jersey Work Plan 2023 - Period 2", - dueDate: convertDateEtToUtc("11/01/2023"), - lastAlteredBy: "Anthony Soprano", reportType: "WP", + state: "NJ", + id: "way-too-new", + submissionName: "New Jersey Work Plan 2024 - Period 2", + status: ReportStatus.APPROVED, + createdAt: 1699496172798, + lastAltered: 1699496172798, + lastAlteredBy: "Anthony Soprano", + dueDate: convertDateEtToUtc("11/01/2023"), reportPeriod: 2, - createdAt: 1699496227241, reportYear: 2023, - lastAltered: 1699496227241, - state: "NJ", - id: "2Xv4TaPFSy9Q0ZGSVB0wuzwtAnA", locked: false, - status: ReportStatus.APPROVED, }, ]; - expect(getEligbleWorkPlan(submissions)).toBe(submissions[0]); + expect(getEligbleWorkPlan(submissions)).toBe(submissions[1]); }); it("should return undefined if not given a submission", async () => {