From f45ffc5dfa9cd47d891234618cc82f33be095c9a Mon Sep 17 00:00:00 2001 From: Angela Cooney Date: Mon, 23 Dec 2024 15:28:43 -0500 Subject: [PATCH] CMDCT-4190: banner edit and adidng test in report create --- services/app-api/handlers/banners/create.ts | 4 ++-- services/app-api/handlers/reports/create.test.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/services/app-api/handlers/banners/create.ts b/services/app-api/handlers/banners/create.ts index 621ec664..16ab6310 100644 --- a/services/app-api/handlers/banners/create.ts +++ b/services/app-api/handlers/banners/create.ts @@ -18,8 +18,8 @@ const validationSchema = object().shape({ title: string().required(), description: string().required(), link: string().url().notRequired(), - startDate: number().required(), - endDate: number().required(), + startDate: number().notRequired(), + endDate: number().notRequired(), }); export const createBanner = handler(parseBannerId, async (request) => { diff --git a/services/app-api/handlers/reports/create.test.ts b/services/app-api/handlers/reports/create.test.ts index b38b4ae0..e801c37a 100644 --- a/services/app-api/handlers/reports/create.test.ts +++ b/services/app-api/handlers/reports/create.test.ts @@ -61,3 +61,12 @@ describe("Test create report handler", () => { expect(res.statusCode).toBe(StatusCodes.Ok); }); }); + +test("Test invalid report type", async () => { + const invalidDataEvent = { + ...proxyEvent, + pathParameters: { reportType: "BM", state: "NM" }, + } as APIGatewayProxyEvent; + const res = await createReport(invalidDataEvent); + expect(res.statusCode).toBe(StatusCodes.BadRequest); +});