Skip to content

Commit

Permalink
Add branching test case for getEligbleWorkplan
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsummers1 committed Jun 13, 2024
1 parent 53aa206 commit 165085c
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions services/ui-src/src/utils/reports/reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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 () => {
Expand Down

0 comments on commit 165085c

Please sign in to comment.