From 15cac0d78e8889bf084981d6cd29147cd67cbf70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Zi=C4=99cina?= Date: Tue, 27 Aug 2024 13:41:19 +0200 Subject: [PATCH 01/17] fix: allow a due date for open waitlist (#4264) * fix: allow a due date for open waitlist * fix: allow a due date for all listing types * fix: remove due date choice field (cherry picked from commit eb912eaae87a070837c3b25647ab2757b80114f5) --- .../cypress/e2e/default/03-listing.spec.ts | 2 -- .../sections/DetailRankingsAndResults.tsx | 7 ----- .../sections/ApplicationDates.tsx | 24 ++++------------- .../sections/RankingsAndResults.tsx | 26 ------------------- sites/partners/src/lib/listings/formTypes.ts | 1 - 5 files changed, 5 insertions(+), 55 deletions(-) diff --git a/sites/partners/cypress/e2e/default/03-listing.spec.ts b/sites/partners/cypress/e2e/default/03-listing.spec.ts index ed3a032d37..685109d677 100644 --- a/sites/partners/cypress/e2e/default/03-listing.spec.ts +++ b/sites/partners/cypress/e2e/default/03-listing.spec.ts @@ -217,7 +217,6 @@ describe("Listing Management Tests", () => { cy.getByID("specialNotes").type(listing["specialNotes"]) cy.get("button").contains("Application Process").click() cy.getByID("reviewOrderFCFS").check() - cy.getByID("dueDateQuestionNo").check() cy.getByID("waitlistOpenNo").check() cy.getByID("leasingAgentName").type(listing["leasingAgentName"]) cy.getByID("leasingAgentEmail").type(listing["leasingAgentEmail"]) @@ -335,7 +334,6 @@ describe("Listing Management Tests", () => { cy.getByID("programRules").contains(listing["programRules"]) cy.getByID("specialNotes").contains(listing["specialNotes"]) cy.getByID("reviewOrderQuestion").contains("First come first serve") - cy.getByID("dueDateQuestion").contains("No") cy.getByID("whatToExpect").contains( "Applicants will be contacted by the property agent in rank order until vacancies are filled. All of the information that you have provided will be verified and your eligibility confirmed. Your application will be removed from the waitlist if you have made any fraudulent statements. If we cannot verify a housing preference that you have claimed, you will not receive the preference but will not be otherwise penalized. Should your application be chosen, be prepared to fill out a more detailed application and provide required supporting documents." ) diff --git a/sites/partners/src/components/listings/PaperListingDetails/sections/DetailRankingsAndResults.tsx b/sites/partners/src/components/listings/PaperListingDetails/sections/DetailRankingsAndResults.tsx index b9d9c88595..d2e0e6d57f 100644 --- a/sites/partners/src/components/listings/PaperListingDetails/sections/DetailRankingsAndResults.tsx +++ b/sites/partners/src/components/listings/PaperListingDetails/sections/DetailRankingsAndResults.tsx @@ -63,13 +63,6 @@ const DetailRankingsAndResults = () => { )} - {getReviewOrderType() === ReviewOrderTypeEnum.firstComeFirstServe && ( - - - {listing.applicationDueDate ? t("t.yes") : t("t.no")} - - - )} {listing.reviewOrderType === ReviewOrderTypeEnum.waitlist && ( <> diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx index c8a6b3d549..7ac16fdf00 100644 --- a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx @@ -1,8 +1,7 @@ import React, { useState, useMemo } from "react" -import { useWatch, useFormContext } from "react-hook-form" +import { useFormContext } from "react-hook-form" import { getDetailFieldDate, getDetailFieldTime } from "../../PaperListingDetails/sections/helpers" import dayjs from "dayjs" -import { YesNoEnum } from "@bloom-housing/shared-helpers/src/types/backend-swagger" import { t, DateField, TimeField, MinimalTable } from "@bloom-housing/ui-components" import { Button, Dialog, Drawer, Link, Grid } from "@bloom-housing/ui-seeds" import { FormListing, TempEvent } from "../../../../lib/listings/formTypes" @@ -72,12 +71,7 @@ const ApplicationDates = ({ const formMethods = useFormContext() // eslint-disable-next-line @typescript-eslint/unbound-method - const { register, watch, control } = formMethods - - const enableDueDate = useWatch({ - control, - name: "dueDateQuestion", - }) + const { register, watch } = formMethods const [drawerOpenHouse, setDrawerOpenHouse] = useState(false) const [modalDeleteOpenHouse, setModalDeleteOpenHouse] = useState(null) @@ -118,7 +112,6 @@ const ApplicationDates = ({ register={register} watch={watch} note={t("listings.whenApplicationsClose")} - disabled={disableDueDate || enableDueDate === YesNoEnum.no} defaultDate={{ month: listing?.applicationDueDate ? dayjs(new Date(listing?.applicationDueDate)).format("MM") @@ -139,23 +132,16 @@ const ApplicationDates = ({ id={"applicationDueTimeField"} register={register} watch={watch} - disabled={disableDueDate || enableDueDate === YesNoEnum.no} defaultValues={{ hours: listing?.applicationDueDate ? dayjs(new Date(listing?.applicationDueDate)).format("hh") - : enableDueDate === YesNoEnum.no - ? null - : "05", + : null, minutes: listing?.applicationDueDate ? dayjs(new Date(listing?.applicationDueDate)).format("mm") - : enableDueDate === YesNoEnum.no - ? null - : "00", + : null, seconds: listing?.applicationDueDate ? dayjs(new Date(listing?.applicationDueDate)).format("ss") - : enableDueDate === YesNoEnum.no - ? null - : "00", + : null, period: listing?.applicationDueDate ? new Date(listing?.applicationDueDate).getHours() >= 12 ? "pm" diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx index 4afe16a39b..8788c286ea 100644 --- a/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx @@ -100,32 +100,6 @@ const RankingsAndResults = ({ listing, disableDueDates, isAdmin }: RankingsAndRe )} - {reviewOrder === "reviewOrderFCFS" && ( - - -

{t("listings.dueDateQuestion")}

- -
-
- )} {reviewOrder === "reviewOrderLottery" && ( <> {process.env.showLottery && ( diff --git a/sites/partners/src/lib/listings/formTypes.ts b/sites/partners/src/lib/listings/formTypes.ts index 4096c11e81..756c316895 100644 --- a/sites/partners/src/lib/listings/formTypes.ts +++ b/sites/partners/src/lib/listings/formTypes.ts @@ -45,7 +45,6 @@ export type FormListing = Omit & { commonDigitalApplicationChoice?: YesNoEnum paperApplicationChoice?: YesNoEnum referralOpportunityChoice?: YesNoEnum - dueDateQuestionChoice?: YesNoEnum criteriaAttachType?: string lotteryDate?: { month: string From 884f63b3d222832f85732ea62f60562db5e90b45 Mon Sep 17 00:00:00 2001 From: Jared White Date: Wed, 23 Oct 2024 14:38:40 -0700 Subject: [PATCH 02/17] feat: improve client-side field validation on Partners listings (#4331) * feat: improve client-side field validation on Partners listings * feat: additional error reporting * fix: make lottery dates/times required * fix: use time error values for time fields * test: update demographics queries not to use title attribute (cherry picked from commit 94b4ef3e5a12c327ec7845e228f1199c00c08d54) --- shared-helpers/package.json | 2 +- sites/partners/package.json | 2 +- .../sections/FormApplicationData.tsx | 2 + .../PaperListingForm/OpenHouseForm.tsx | 5 +- .../listings/PaperListingForm/index.tsx | 70 ++++++++++--------- .../sections/ApplicationAddress.tsx | 4 ++ .../sections/ApplicationDates.tsx | 6 +- .../sections/RankingsAndResults.tsx | 19 +++-- .../applications/review/demographics.test.tsx | 29 ++++---- sites/public/package.json | 2 +- yarn.lock | 8 +-- 11 files changed, 84 insertions(+), 65 deletions(-) diff --git a/shared-helpers/package.json b/shared-helpers/package.json index dd3f8b78a1..97b6a5050b 100644 --- a/shared-helpers/package.json +++ b/shared-helpers/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@bloom-housing/doorway-ui-components": "^1.0.0", - "@bloom-housing/ui-components": "12.1.6", + "@bloom-housing/ui-components": "12.4.0", "@bloom-housing/ui-seeds": "1.17.0", "@heroicons/react": "^2.1.1", "axios-cookiejar-support": "4.0.6", diff --git a/sites/partners/package.json b/sites/partners/package.json index da54fd3deb..d2a604a64b 100644 --- a/sites/partners/package.json +++ b/sites/partners/package.json @@ -31,7 +31,7 @@ "dependencies": { "@bloom-housing/doorway-ui-components": "^1.0.0", "@bloom-housing/shared-helpers": "^7.7.1", - "@bloom-housing/ui-components": "12.1.6", + "@bloom-housing/ui-components": "12.4.0", "@bloom-housing/ui-seeds": "1.17.0", "@heroicons/react": "^2.1.1", "@mapbox/mapbox-sdk": "^0.13.0", diff --git a/sites/partners/src/components/applications/PaperApplicationForm/sections/FormApplicationData.tsx b/sites/partners/src/components/applications/PaperApplicationForm/sections/FormApplicationData.tsx index c179f28701..bd09f41468 100644 --- a/sites/partners/src/components/applications/PaperApplicationForm/sections/FormApplicationData.tsx +++ b/sites/partners/src/components/applications/PaperApplicationForm/sections/FormApplicationData.tsx @@ -67,6 +67,7 @@ const FormApplicationData = (props: FormApplicationDataProps) => { register={register} error={errors?.dateSubmitted} watch={watch} + setValue={setValue} label={t("application.add.dateSubmitted")} errorMessage={t("errors.dateError")} required={!!isDateRequired} @@ -80,6 +81,7 @@ const FormApplicationData = (props: FormApplicationDataProps) => { name="timeSubmitted" label={t("application.add.timeSubmitted")} register={register} + setValue={setValue} watch={watch} error={!!errors?.timeSubmitted} disabled={!isDateFilled} diff --git a/sites/partners/src/components/listings/PaperListingForm/OpenHouseForm.tsx b/sites/partners/src/components/listings/PaperListingForm/OpenHouseForm.tsx index 1918befc65..5d85909aa0 100644 --- a/sites/partners/src/components/listings/PaperListingForm/OpenHouseForm.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/OpenHouseForm.tsx @@ -61,7 +61,7 @@ const OpenHouseForm = ({ onSubmit, currentEvent }: OpenHouseFormProps) => { })() // eslint-disable-next-line @typescript-eslint/unbound-method - const { register, watch, trigger, getValues, errors } = useForm({ + const { register, setValue, watch, trigger, getValues, errors } = useForm({ defaultValues, }) @@ -107,6 +107,7 @@ const OpenHouseForm = ({ onSubmit, currentEvent }: OpenHouseFormProps) => { name="date" id="date" register={register} + setValue={setValue} watch={watch} error={errors?.date} errorMessage={t("errors.requiredFieldError")} @@ -120,6 +121,7 @@ const OpenHouseForm = ({ onSubmit, currentEvent }: OpenHouseFormProps) => { name="startTime" id="startTime" register={register} + setValue={setValue} watch={watch} error={!!errors?.startTime} required @@ -132,6 +134,7 @@ const OpenHouseForm = ({ onSubmit, currentEvent }: OpenHouseFormProps) => { name="endTime" id="endTime" register={register} + setValue={setValue} watch={watch} error={!!errors?.endTime} required diff --git a/sites/partners/src/components/listings/PaperListingForm/index.tsx b/sites/partners/src/components/listings/PaperListingForm/index.tsx index b1c044dcbd..187057ad66 100644 --- a/sites/partners/src/components/listings/PaperListingForm/index.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/index.tsx @@ -191,44 +191,50 @@ const ListingForm = ({ listing, editMode, setListingName }: ListingFormProps) => try { setLoading(true) clearErrors() - - const dataPipeline = new ListingDataPipeline(formData, { - preferences, - programs, - units, - openHouseEvents, - profile: profile, - latLong, - customMapPositionChosen, - }) - const formattedData = await dataPipeline.run() - let result - if (editMode) { - result = await listingsService.update({ - id: listing.id, - body: { id: listing.id, ...(formattedData as unknown as ListingUpdate) }, - }) - } else { - result = await listingsService.create({ - body: formattedData as unknown as ListingCreate, + const successful = await formMethods.trigger() + + if (successful) { + const dataPipeline = new ListingDataPipeline(formData, { + preferences, + programs, + units, + openHouseEvents, + profile: profile, + latLong, + customMapPositionChosen, }) - } + const formattedData = await dataPipeline.run() + let result + if (editMode) { + result = await listingsService.update({ + id: listing.id, + body: { id: listing.id, ...(formattedData as unknown as ListingUpdate) }, + }) + } else { + result = await listingsService.create({ + body: formattedData as unknown as ListingCreate, + }) + } - reset(formData) + reset(formData) - if (result) { - addToast(getToast(listing, listing?.status, formattedData?.status), { - variant: "success", - }) + if (result) { + addToast(getToast(listing, listing?.status, formattedData?.status), { + variant: "success", + }) - if (continueEditing) { - setAlert(null) - setListingName(result.name) - } else { - await router.push(`/listings/${result.id}`) + if (continueEditing) { + setAlert(null) + setListingName(result.name) + } else { + await router.push(`/listings/${result.id}`) + } } + setLoading(false) + } else { + setLoading(false) + setAlert("form") } - setLoading(false) } catch (err) { reset(formData) setLoading(false) diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationAddress.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationAddress.tsx index 4817f6c2d3..e566c557e5 100644 --- a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationAddress.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationAddress.tsx @@ -705,7 +705,9 @@ const ApplicationAddress = ({ listing }: ApplicationAddressProps) => { name={"postmarkByDateDateField"} id={"postmarkByDateDateField"} register={register} + setValue={setValue} watch={watch} + error={errors?.postmarkByDateDateField} defaultDate={{ month: listing?.postmarkedApplicationsReceivedByDate ? dayjsDate.format("MM") @@ -728,7 +730,9 @@ const ApplicationAddress = ({ listing }: ApplicationAddressProps) => { name={"postmarkByDateTimeField"} id={"postmarkByDateTimeField"} register={register} + setValue={setValue} watch={watch} + error={errors?.postmarkByDateTimeField} defaultValues={{ hours: listing?.postmarkedApplicationsReceivedByDate ? dayjsDate.format("hh") diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx index 7ac16fdf00..73d19f53d0 100644 --- a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx @@ -71,7 +71,7 @@ const ApplicationDates = ({ const formMethods = useFormContext() // eslint-disable-next-line @typescript-eslint/unbound-method - const { register, watch } = formMethods + const { errors, register, setValue, watch } = formMethods const [drawerOpenHouse, setDrawerOpenHouse] = useState(false) const [modalDeleteOpenHouse, setModalDeleteOpenHouse] = useState(null) @@ -110,7 +110,9 @@ const ApplicationDates = ({ name={"applicationDueDateField"} id={"applicationDueDateField"} register={register} + setValue={setValue} watch={watch} + error={errors?.applicationDueDateField} note={t("listings.whenApplicationsClose")} defaultDate={{ month: listing?.applicationDueDate @@ -131,7 +133,9 @@ const ApplicationDates = ({ name={"applicationDueTimeField"} id={"applicationDueTimeField"} register={register} + setValue={setValue} watch={watch} + error={errors?.applicationDueTimeField} defaultValues={{ hours: listing?.applicationDueDate ? dayjs(new Date(listing?.applicationDueDate)).format("hh") diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx index 8788c286ea..9dd60a5769 100644 --- a/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/sections/RankingsAndResults.tsx @@ -24,7 +24,7 @@ const RankingsAndResults = ({ listing, disableDueDates, isAdmin }: RankingsAndRe const formMethods = useFormContext() // eslint-disable-next-line @typescript-eslint/unbound-method - const { register, watch, control, errors } = formMethods + const { register, setValue, watch, control, errors } = formMethods const lotteryEvent = getLotteryEvent(listing as unknown as Listing) @@ -62,6 +62,7 @@ const RankingsAndResults = ({ listing, disableDueDates, isAdmin }: RankingsAndRe value: YesNoEnum.no, }, ] + return ( <> { }) it("should show other text fields when other options are checked", async () => { - const { getByLabelText, findAllByTestId } = render() + const { getByText, queryByTestId, findAllByTestId } = render() - fireEvent.click(getByLabelText("Asian")) - expect(await findAllByTestId("asian-otherAsian")).toHaveLength(1) - fireEvent.click(getByLabelText("Other Asian")) + expect(queryByTestId("asian-otherAsian")).not.toBeInTheDocument() + fireEvent.click(getByText("Asian")) + fireEvent.click(getByText("Other Asian")) expect(await findAllByTestId("asian-otherAsian")).toHaveLength(2) fireEvent.click(getByLabelText("Black")) @@ -171,22 +171,17 @@ describe("applications pages", () => { fireEvent.click(getByLabelText("Middle Eastern, West African or North African")) expect( - await findAllByTestId("middleEasternOrAfrican-otherMiddleEasternNorthAfrican") - ).toHaveLength(1) - fireEvent.click(getByLabelText("Other Middle Eastern or North African")) + queryByTestId("nativeHawaiianOtherPacificIslander-otherPacificIslander") + ).not.toBeInTheDocument() + fireEvent.click(getByText("Native Hawaiian / Other Pacific Islander")) + fireEvent.click(getByText("Other Pacific Islander")) expect( - await findAllByTestId("middleEasternOrAfrican-otherMiddleEasternNorthAfrican") + await findAllByTestId("nativeHawaiianOtherPacificIslander-otherPacificIslander") ).toHaveLength(2) - fireEvent.click(getByLabelText("Pacific Islander")) - expect(await findAllByTestId("pacificIslander-otherPacificIslander")).toHaveLength(1) - fireEvent.click(getByLabelText("Other Pacific Islander")) - expect(await findAllByTestId("pacificIslander-otherPacificIslander")).toHaveLength(2) - - fireEvent.click(getByLabelText("White")) - expect(await findAllByTestId("white-otherWhite")).toHaveLength(1) - fireEvent.click(getByLabelText("Other White")) - expect(await findAllByTestId("white-otherWhite")).toHaveLength(2) + expect(await findAllByTestId("otherMultiracial")).toHaveLength(1) + fireEvent.click(getByText("Other / Multiracial")) + expect(await findAllByTestId("otherMultiracial")).toHaveLength(2) }) }) }) diff --git a/sites/public/package.json b/sites/public/package.json index 7b59c46976..99cdc78fbd 100644 --- a/sites/public/package.json +++ b/sites/public/package.json @@ -31,7 +31,7 @@ "dependencies": { "@bloom-housing/doorway-ui-components": "^1.0.0", "@bloom-housing/shared-helpers": "^7.7.1", - "@bloom-housing/ui-components": "12.1.6", + "@bloom-housing/ui-components": "12.4.0", "@bloom-housing/ui-seeds": "1.17.0", "@heroicons/react": "^2.1.1", "@react-google-maps/api": "^2.18.1", diff --git a/yarn.lock b/yarn.lock index 81619abf26..44b73f92cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1732,10 +1732,10 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bloom-housing/ui-components@12.1.6": - version "12.1.6" - resolved "https://registry.yarnpkg.com/@bloom-housing/ui-components/-/ui-components-12.1.6.tgz#e451ceb89f03044cfeb7e6995fd088f11712b9af" - integrity sha512-FjoRwau2o3jTgBtuRFLEcM5nhSxjr2n5pzNyx8bjGHZbX/721EYpR/RL2dJekTxYaUgHsI9vK5d9BK74IZxzMA== +"@bloom-housing/ui-components@12.4.0": + version "12.4.0" + resolved "https://registry.yarnpkg.com/@bloom-housing/ui-components/-/ui-components-12.4.0.tgz#bc36172c4d500ecd632d440d58af4183904cf882" + integrity sha512-c67UsaZZF8LG3J5AzdbBcNfRf70+rLaQjjQxbH+dTHnH8GvPffKF9kL/vICldPHIm+qO+5Uc7paYXITzKFZp+w== dependencies: "@fortawesome/fontawesome-svg-core" "^6.1.1" "@fortawesome/free-regular-svg-icons" "^6.1.1" From 8153e90fe1b7b3d2bc6991f8d0aa1e2f661da79f Mon Sep 17 00:00:00 2001 From: Jared White Date: Fri, 8 Nov 2024 12:06:41 -0800 Subject: [PATCH 03/17] feat: validate required Application Due Date for FCFC & Lottery (#4417) * feat: add validation for application due date but not on open waitlist * fix: refactor logic of the validator * test: add due date entry * test: fix lexical scope issue * test: ensure app due date is always filled out * chore: add comments (cherry picked from commit fe9a1ddcac671075cdefd4b152a90ecd0aee84e3) --- .../listings/listing-published-update.dto.ts | 20 +++++++++++ .../cypress/e2e/default/03-listing.spec.ts | 8 +++++ .../cypress/fixtures/minimalListing.json | 6 +++- sites/partners/cypress/support/commands.js | 34 ++++++++++++------- .../sections/ApplicationDates.tsx | 12 +++++-- 5 files changed, 64 insertions(+), 16 deletions(-) diff --git a/api/src/dtos/listings/listing-published-update.dto.ts b/api/src/dtos/listings/listing-published-update.dto.ts index 445759f9b6..b1a3c16710 100644 --- a/api/src/dtos/listings/listing-published-update.dto.ts +++ b/api/src/dtos/listings/listing-published-update.dto.ts @@ -4,12 +4,14 @@ import { ArrayMaxSize, ArrayMinSize, IsBoolean, + IsDate, IsDefined, IsEmail, IsEnum, IsPhoneNumber, IsString, MaxLength, + ValidateIf, ValidateNested, } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; @@ -39,6 +41,7 @@ export class ListingPublishedUpdate extends OmitType(ListingUpdate, [ 'reviewOrderType', 'units', 'listingsBuildingAddress', + 'applicationDueDate', ]) { @Expose() @ValidateNested({ groups: [ValidationsGroupsEnum.default], each: true }) @@ -150,4 +153,21 @@ export class ListingPublishedUpdate extends OmitType(ListingUpdate, [ @ArrayMaxSize(256, { groups: [ValidationsGroupsEnum.default] }) @Type(() => UnitCreate) units: UnitCreate[]; + + @Expose() + @IsDate({ groups: [ValidationsGroupsEnum.default] }) + @ValidateIf( + (o) => + !( + o.applicationDueDate == undefined && + o.reviewOrderType == ReviewOrderTypeEnum.waitlist + ), + { + groups: [ValidationsGroupsEnum.default], + }, + ) + @IsDefined({ groups: [ValidationsGroupsEnum.default] }) + @Type(() => Date) + @ApiProperty() + applicationDueDate: Date; } diff --git a/sites/partners/cypress/e2e/default/03-listing.spec.ts b/sites/partners/cypress/e2e/default/03-listing.spec.ts index 685109d677..fd651a7a81 100644 --- a/sites/partners/cypress/e2e/default/03-listing.spec.ts +++ b/sites/partners/cypress/e2e/default/03-listing.spec.ts @@ -87,6 +87,7 @@ describe("Listing Management Tests", () => { }) }) + // Fill out a First Come, First Serve (FCFS) listing // eslint-disable-next-line @typescript-eslint/no-explicit-any function fillOutListing(cy: Cypress.cy, listing: any): void { cy.getByID("jurisdictions.id").select(listing["jurisdiction.id"]) @@ -270,6 +271,13 @@ describe("Listing Management Tests", () => { cy.getByID("startTime.period").select("AM") cy.getByID("endTime.period").select("PM") cy.getByID("saveOpenHouseFormButton").contains("Save").click() + + cy.getByID("applicationDueDateField.month").type(listing["date.month"]) + cy.getByID("applicationDueDateField.day").type(listing["date.day"]) + cy.getByID("applicationDueDateField.year").type((new Date().getFullYear() + 1).toString()) + cy.getByID("applicationDueTimeField.hours").type(listing["startTime.hours"]) + cy.getByID("applicationDueTimeField.minutes").type(listing["startTime.minutes"]) + cy.getByID("applicationDueTimeField.period").select("PM") cy.getByID("publishButton").contains("Publish").click() cy.getByID("publishButtonConfirm").contains("Publish").click() diff --git a/sites/partners/cypress/fixtures/minimalListing.json b/sites/partners/cypress/fixtures/minimalListing.json index b37a8bce84..f79922f47f 100644 --- a/sites/partners/cypress/fixtures/minimalListing.json +++ b/sites/partners/cypress/fixtures/minimalListing.json @@ -11,5 +11,9 @@ "unitType.id": "One Bedroom", "leasingAgentName": "Basic Agent Name", "leasingAgentEmail": "basicAgent@email.com", - "leasingAgentPhone": "520-245-8811" + "leasingAgentPhone": "520-245-8811", + "date.month": "10", + "date.day": "04", + "date.hours": "10", + "date.minutes": "04" } diff --git a/sites/partners/cypress/support/commands.js b/sites/partners/cypress/support/commands.js index db38a4e1da..2bbdc0efe6 100644 --- a/sites/partners/cypress/support/commands.js +++ b/sites/partners/cypress/support/commands.js @@ -384,7 +384,8 @@ Cypress.Commands.add("verifyTerms", (application) => { }) Cypress.Commands.add("addMinimalListing", (listingName, isLottery, isApproval, jurisdiction) => { - // Create and publish minimal lottery listing + // Create and publish minimal FCFS or Lottery listing + // TODO: test Open Waitlist, though maybe with integration test instead cy.getByID("addListingButton").contains("Add Listing").click() cy.contains("New Listing") cy.fixture("minimalListing").then((listing) => { @@ -445,19 +446,26 @@ Cypress.Commands.add("addMinimalListing", (listingName, isLottery, isApproval, j cy.getByID("digitalApplicationChoiceYes").check() cy.getByID("commonDigitalApplicationChoiceYes").check() cy.getByID("paperApplicationNo").check() - - if (isApproval) { - cy.getByID("submitButton").contains("Submit").click() - cy.getByID("submitListingForApprovalButtonConfirm").contains("Submit").click() - cy.getByTestId("page-header").should("be.visible") - cy.getByTestId("page-header").should("have.text", listingName) - } else { - cy.getByID("publishButton").contains("Publish").click() - cy.getByID("publishButtonConfirm").contains("Publish").click() - cy.get("[data-testid=page-header]").should("be.visible") - cy.getByTestId("page-header").should("have.text", listingName) - } + cy.getByID("referralOpportunityNo").check() + cy.getByID("applicationDueDateField.month").type(listing["date.month"]) + cy.getByID("applicationDueDateField.day").type(listing["date.day"]) + cy.getByID("applicationDueDateField.year").type((new Date().getFullYear() + 1).toString()) + cy.getByID("applicationDueTimeField.hours").type(listing["date.hours"]) + cy.getByID("applicationDueTimeField.minutes").type(listing["date.minutes"]) + cy.getByID("applicationDueTimeField.period").select("PM") }) + + if (isApproval) { + cy.getByID("submitButton").contains("Submit").click() + cy.getByID("submitListingForApprovalButtonConfirm").contains("Submit").click() + cy.getByTestId("page-header").should("be.visible") + cy.getByTestId("page-header").should("have.text", listingName) + } else { + cy.getByID("publishButton").contains("Publish").click() + cy.getByID("publishButtonConfirm").contains("Publish").click() + cy.get("[data-testid=page-header]").should("be.visible") + cy.getByTestId("page-header").should("have.text", listingName) + } }) Cypress.Commands.add("addMinimalApplication", (listingName) => { diff --git a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx index 73d19f53d0..1bd8fad0c3 100644 --- a/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/sections/ApplicationDates.tsx @@ -96,6 +96,8 @@ const ApplicationDates = ({ setModalDeleteOpenHouse(null) } + const hasDueDateError = errors?.applicationDueDate || errors?.applicationDueDateField + return ( <>
@@ -112,7 +114,13 @@ const ApplicationDates = ({ register={register} setValue={setValue} watch={watch} - error={errors?.applicationDueDateField} + error={ + hasDueDateError && { + month: hasDueDateError, + day: hasDueDateError, + year: hasDueDateError, + } + } note={t("listings.whenApplicationsClose")} defaultDate={{ month: listing?.applicationDueDate @@ -135,7 +143,7 @@ const ApplicationDates = ({ register={register} setValue={setValue} watch={watch} - error={errors?.applicationDueTimeField} + error={errors?.applicationDueDate || errors?.applicationDueTimeField} defaultValues={{ hours: listing?.applicationDueDate ? dayjs(new Date(listing?.applicationDueDate)).format("hh") From dac887c0a7fcf0b735f76c613fda0e49c8f2941a Mon Sep 17 00:00:00 2001 From: Jared White Date: Tue, 12 Nov 2024 15:52:31 -0800 Subject: [PATCH 04/17] fix: lint warning --- sites/public/src/pages/applications/review/confirmation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/public/src/pages/applications/review/confirmation.tsx b/sites/public/src/pages/applications/review/confirmation.tsx index e3171e3f5c..ba64baeed7 100644 --- a/sites/public/src/pages/applications/review/confirmation.tsx +++ b/sites/public/src/pages/applications/review/confirmation.tsx @@ -40,7 +40,7 @@ const ApplicationConfirmation = () => { default: return { text: "" } } - }, [listing, router.locale]) + }, [listing]) const contentUpdates = useMemo(() => { switch (listing?.reviewOrderType) { From ca3eaa9cb9e5e8a489835363a076be53d1ca9b9f Mon Sep 17 00:00:00 2001 From: Jared White Date: Thu, 14 Nov 2024 17:57:46 -0800 Subject: [PATCH 05/17] test: revert change to demographics public test --- .../applications/review/demographics.test.tsx | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/sites/public/__tests__/pages/applications/review/demographics.test.tsx b/sites/public/__tests__/pages/applications/review/demographics.test.tsx index 8ac1f30f99..21c632f3c8 100644 --- a/sites/public/__tests__/pages/applications/review/demographics.test.tsx +++ b/sites/public/__tests__/pages/applications/review/demographics.test.tsx @@ -147,11 +147,11 @@ describe("applications pages", () => { }) it("should show other text fields when other options are checked", async () => { - const { getByText, queryByTestId, findAllByTestId } = render() + const { getByLabelText, findAllByTestId } = render() - expect(queryByTestId("asian-otherAsian")).not.toBeInTheDocument() - fireEvent.click(getByText("Asian")) - fireEvent.click(getByText("Other Asian")) + fireEvent.click(getByLabelText("Asian")) + expect(await findAllByTestId("asian-otherAsian")).toHaveLength(1) + fireEvent.click(getByLabelText("Other Asian")) expect(await findAllByTestId("asian-otherAsian")).toHaveLength(2) fireEvent.click(getByLabelText("Black")) @@ -171,17 +171,22 @@ describe("applications pages", () => { fireEvent.click(getByLabelText("Middle Eastern, West African or North African")) expect( - queryByTestId("nativeHawaiianOtherPacificIslander-otherPacificIslander") - ).not.toBeInTheDocument() - fireEvent.click(getByText("Native Hawaiian / Other Pacific Islander")) - fireEvent.click(getByText("Other Pacific Islander")) + await findAllByTestId("middleEasternOrAfrican-otherMiddleEasternNorthAfrican") + ).toHaveLength(1) + fireEvent.click(getByLabelText("Other Middle Eastern or North African")) expect( - await findAllByTestId("nativeHawaiianOtherPacificIslander-otherPacificIslander") + await findAllByTestId("middleEasternOrAfrican-otherMiddleEasternNorthAfrican") ).toHaveLength(2) - expect(await findAllByTestId("otherMultiracial")).toHaveLength(1) - fireEvent.click(getByText("Other / Multiracial")) - expect(await findAllByTestId("otherMultiracial")).toHaveLength(2) + fireEvent.click(getByLabelText("Pacific Islander")) + expect(await findAllByTestId("pacificIslander-otherPacificIslander")).toHaveLength(1) + fireEvent.click(getByLabelText("Other Pacific Islander")) + expect(await findAllByTestId("pacificIslander-otherPacificIslander")).toHaveLength(2) + + fireEvent.click(getByLabelText("White")) + expect(await findAllByTestId("white-otherWhite")).toHaveLength(1) + fireEvent.click(getByLabelText("Other White")) + expect(await findAllByTestId("white-otherWhite")).toHaveLength(2) }) }) }) From 4098f4418bfffdc1f7b4c2b0d985a6d0cc5362a6 Mon Sep 17 00:00:00 2001 From: Jared White Date: Thu, 14 Nov 2024 20:22:55 -0800 Subject: [PATCH 06/17] fix: uic versions --- doorway-ui-components/package.json | 2 +- yarn.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doorway-ui-components/package.json b/doorway-ui-components/package.json index f5866df0df..6397f03ef3 100644 --- a/doorway-ui-components/package.json +++ b/doorway-ui-components/package.json @@ -51,7 +51,7 @@ "typescript": "^4.9.4" }, "dependencies": { - "@bloom-housing/ui-components": "12.1.6", + "@bloom-housing/ui-components": "12.4.0", "ag-grid-community": "^26.0.0", "markdown-to-jsx": "7.1.8", "nanoid": "^3.3.6", diff --git a/yarn.lock b/yarn.lock index fba8205132..a50939fc04 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14631,13 +14631,6 @@ rfdc@^1.3.0: resolved "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz" integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== -rimraf@3.0.2, rimraf@^3.0.0, rimraf@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== - dependencies: - glob "^7.1.3" - rimraf@^2.6.3: version "2.7.1" resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz" @@ -14645,6 +14638,13 @@ rimraf@^2.6.3: dependencies: glob "^7.1.3" +rimraf@^3.0.0, rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + rollup@2.78.0: version "2.78.0" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.78.0.tgz#00995deae70c0f712ea79ad904d5f6b033209d9e" From 3a112d5fa04c5a64b0e921a7b3c3a8fb75d67038 Mon Sep 17 00:00:00 2001 From: Jared White Date: Fri, 15 Nov 2024 15:13:20 -0800 Subject: [PATCH 07/17] fix: unnecessary field check --- sites/partners/cypress/support/commands.js | 1 - 1 file changed, 1 deletion(-) diff --git a/sites/partners/cypress/support/commands.js b/sites/partners/cypress/support/commands.js index 2bbdc0efe6..d0712c6330 100644 --- a/sites/partners/cypress/support/commands.js +++ b/sites/partners/cypress/support/commands.js @@ -446,7 +446,6 @@ Cypress.Commands.add("addMinimalListing", (listingName, isLottery, isApproval, j cy.getByID("digitalApplicationChoiceYes").check() cy.getByID("commonDigitalApplicationChoiceYes").check() cy.getByID("paperApplicationNo").check() - cy.getByID("referralOpportunityNo").check() cy.getByID("applicationDueDateField.month").type(listing["date.month"]) cy.getByID("applicationDueDateField.day").type(listing["date.day"]) cy.getByID("applicationDueDateField.year").type((new Date().getFullYear() + 1).toString()) From f02fe58404ec69538be282fc479970b93689065d Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 18 Nov 2024 15:40:19 -0800 Subject: [PATCH 08/17] test: add due date --- .../permission-as-juris-admin-correct-juris.e2e-spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-juris-admin-correct-juris.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-juris-admin-correct-juris.e2e-spec.ts index 3866035582..1562774b08 100644 --- a/api/test/integration/permission-tests/permission-as-juris-admin-correct-juris.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-juris-admin-correct-juris.e2e-spec.ts @@ -1120,7 +1120,9 @@ describe('Testing Permissioning of endpoints as Jurisdictional Admin in the corr }); it('should succeed for update endpoint & create an activity log entry', async () => { - const listingData = await listingFactory(jurisId, prisma); + const listingData = await listingFactory(jurisId, prisma, { + applicationDueDate: new Date(), + }); const listing = await prisma.listings.create({ data: listingData, }); From 70e7104c745b31afae38d028b0519ec0d0fac131 Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 18 Nov 2024 15:55:16 -0800 Subject: [PATCH 09/17] test: add due date in another test --- ...ermission-as-limited-juris-admin-correct-juris.e2e-spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-limited-juris-admin-correct-juris.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-limited-juris-admin-correct-juris.e2e-spec.ts index fd74592897..10bf7a2b0d 100644 --- a/api/test/integration/permission-tests/permission-as-limited-juris-admin-correct-juris.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-limited-juris-admin-correct-juris.e2e-spec.ts @@ -1063,7 +1063,9 @@ describe('Testing Permissioning of endpoints as Limited Jurisdictional Admin in }); it('should succeed for update endpoint & create an activity log entry when user is not updating dates', async () => { - const listingData = await listingFactory(jurisId, prisma); + const listingData = await listingFactory(jurisId, prisma, { + applicationDueDate: new Date(), + }); const listing = await prisma.listings.create({ data: listingData, }); From 1acb74b815fc873835b9ce9768e7deab0de00d32 Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 18 Nov 2024 16:01:42 -0800 Subject: [PATCH 10/17] test: third time's a charm --- .../permission-as-partner-correct-listing.e2e-spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index a11e321d36..8e173ae353 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -1078,7 +1078,7 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( userListingId, jurisId, ); - val.applicationDueDate = new Date('05-16-2024 01:25:18PM GMT+2'); + val.applicationDueDate = new Date('05-16-2025 01:25:18'); val.reviewOrderType = null; await request(app.getHttpServer()) From b6e4ea90a1a6c9e317d502ead42968da2df3273b Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 18 Nov 2024 16:14:04 -0800 Subject: [PATCH 11/17] test: don't set null listing type --- .../permission-as-partner-correct-listing.e2e-spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index 8e173ae353..6b73d1c91d 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -1079,7 +1079,6 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( jurisId, ); val.applicationDueDate = new Date('05-16-2025 01:25:18'); - val.reviewOrderType = null; await request(app.getHttpServer()) .put(`/listings/${userListingId}`) From b8484bbfb2037ea7c73116796c84211724358c34 Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 18 Nov 2024 16:25:39 -0800 Subject: [PATCH 12/17] test: try reset to Core --- .../permission-as-partner-correct-listing.e2e-spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index 6b73d1c91d..2e1ebd7f03 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -1078,7 +1078,7 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( userListingId, jurisId, ); - val.applicationDueDate = new Date('05-16-2025 01:25:18'); + val.applicationDueDate = new Date('05-16-2025 01:25:18').toISOString(); await request(app.getHttpServer()) .put(`/listings/${userListingId}`) From 7da10011e6e1829adb18271d7572be123f98e965 Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 18 Nov 2024 16:34:57 -0800 Subject: [PATCH 13/17] test: try reset to Core --- .../permission-as-partner-correct-listing.e2e-spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index 2e1ebd7f03..746455a8b8 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -1078,7 +1078,6 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( userListingId, jurisId, ); - val.applicationDueDate = new Date('05-16-2025 01:25:18').toISOString(); await request(app.getHttpServer()) .put(`/listings/${userListingId}`) From 847fe7dcc7630ae26d8cfe83fb818d8585222f18 Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 18 Nov 2024 19:11:47 -0800 Subject: [PATCH 14/17] test: resolve 403 error in test --- .../permission-as-partner-correct-listing.e2e-spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index 746455a8b8..3e76a22e7b 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -1078,6 +1078,7 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( userListingId, jurisId, ); + val.reviewOrderType = null; await request(app.getHttpServer()) .put(`/listings/${userListingId}`) From 88c1b28d6f4499f2278589e52efda48d5a9870ad Mon Sep 17 00:00:00 2001 From: Jared White Date: Tue, 19 Nov 2024 12:10:09 -0800 Subject: [PATCH 15/17] test: don't set a new due date --- .../permission-as-partner-correct-listing.e2e-spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index 3e76a22e7b..d49dd69b54 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -1078,7 +1078,7 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( userListingId, jurisId, ); - val.reviewOrderType = null; + val.applicationDueDate = undefined; await request(app.getHttpServer()) .put(`/listings/${userListingId}`) From 2e239b8da04984af3e5d60226e59e89c50a22b91 Mon Sep 17 00:00:00 2001 From: Jared White Date: Tue, 19 Nov 2024 12:20:52 -0800 Subject: [PATCH 16/17] test: try deleting --- .../permission-as-partner-correct-listing.e2e-spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index d49dd69b54..6b7691b4cb 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -1078,7 +1078,7 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( userListingId, jurisId, ); - val.applicationDueDate = undefined; + delete val.applicationDueDate; await request(app.getHttpServer()) .put(`/listings/${userListingId}`) From ee7d52d1239ba5c9023478899a0f33eb3d24820e Mon Sep 17 00:00:00 2001 From: Jared White Date: Wed, 20 Nov 2024 13:24:31 -0800 Subject: [PATCH 17/17] test: make sure a due date is actually set, as it's required --- ...permission-as-partner-correct-listing.e2e-spec.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts index 6b7691b4cb..6896c14d91 100644 --- a/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts +++ b/api/test/integration/permission-tests/permission-as-partner-correct-listing.e2e-spec.ts @@ -128,7 +128,10 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( listingMulitselectQuestion = msq.id; + const tomorrowsDate = new Date(); + tomorrowsDate.setDate(tomorrowsDate.getDate() + 1); const listingData = await listingFactory(jurisId, prisma, { + applicationDueDate: tomorrowsDate, multiselectQuestions: [msq], digitalApp: true, }); @@ -1073,12 +1076,19 @@ describe('Testing Permissioning of endpoints as partner with correct listing', ( }); it('should succeed for update endpoint & create an activity log entry', async () => { + const listing = await prisma.listings.findFirst({ + where: { + id: userListingId, + }, + }); + const val = await constructFullListingData( prisma, userListingId, jurisId, ); - delete val.applicationDueDate; + val.applicationDueDate = listing.applicationDueDate; + val.reviewOrderType = null; await request(app.getHttpServer()) .put(`/listings/${userListingId}`)