Skip to content

Commit

Permalink
update master with latest dev (bloom-housing#1712)
Browse files Browse the repository at this point in the history
* 1545/lat-long draggable map (#1577)

* 1616/user roles (bloom-housing#1673) from 1628

* User roles for partners

* generate migration

* update client

* update seeds and policy

* migrate partners from leasing agent table

* change enum name

* Remove anonymous role

* Update authz.service.ts

* fix application view

* update changelog

* fix backend tests

* add test

* fix ui tests

Co-authored-by: Abbie Farr <afarr@google.com>
Co-authored-by: Abbie Farr <83078310+abbiefarr@users.noreply.github.com>

* Fix code style issues with Prettier

* 1587/Updates Listing Columns and Perms so Leasing Agents can Edit (#1627)

* updates for cache revalidation on the frontend

* fixes listing bug issue

* Updates partner listings columns

* updates policy and user perms

* skips tests until #1616 is implemented

* updates to work with new user roles

* remove origin from listing service list args

* test update

* Fix code style issues with Prettier

* Split Listing form up into two main tabs (#1644)

* Add tabs to the listing form

* Fix button positions and ensure tabs always render

* Add #1644 to Changelog

* fixes warning for ArrowForward props

Co-authored-by: seanmalbert <smabert@gmail.com>

* Contribute Feature/Ensure Progress Bar is screen reader friendly (bloom-housing#1674)

* Add unit size filter to backend (#1660)

* Add unit size filter to backend (#368)

* initial thoughts

* initial bedrooms filter (untested)

* Fix code style issues with Prettier

* fix typo in 'studio'

* remove custom filter handling, switch to bedrooms field on unit table

* add additional check for invalid comparisons, outside the filter handler

* use unit_type table for bedrooms, add field to unit_type table, remove toLowerCase() from filter name comparisons to allow camelCase filter names

* Fix code style issues with Prettier

* add bedrooms filter to frontend comparison map

* fix comparison type for frontend map

* fix test and migration indentation

* update changelog

* regenerate swagger

* fix tests

* try to fix more ui tests

* try to fix more ui tests

* add comment for custom filter handling

Co-authored-by: Lint Action <lint-action@samuelmeuli.com>

* fix missing bedrooms build error

Co-authored-by: Lint Action <lint-action@samuelmeuli.com>

* 1431/google translate (#1590)

* Initial google translate listing

* Translations for arrays

* Disable caching for GET listing endpoint

* Final tweaks to google translate

* Update change log for google translations

* Fix code style issues with Prettier

* Update CHANGELOG.md

* Minor cleanup for Google Translate

* Initial google translate listing

* Translations for arrays

* Disable caching for GET listing endpoint

* Final tweaks to google translate

* Update change log for google translations

* Fix code style issues with Prettier

* Update CHANGELOG.md

* Minor cleanup for Google Translate

* Google translate refactoring

* Fix listings service spec

* adds custom cache interceptor for language

* updates custom cache interceptor

* Add missing Headers import for listings controller

Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
Co-authored-by: seanmalbert <smabert@gmail.com>

* Restructure units summary table (bloom-housing#1670)

* Add UnitsSummary to Listing

* remove listing service changes

* redo migration

* monthlyRent as number

* fix lint errors

* Fix code style issues with Prettier

* Hardcode the number of items in listings.e2e-spec.ts. (#1643)

Using the length of the array from seed.ts was causing flakiness if the
bloom database was not set up in the testing environment.

Co-authored-by: seanmalbert <smabert@gmail.com>

* Contribute/Create listing updated UI component (bloom-housing#1676)

* 1621/Listing Views (#1626)

* set fallback to true for getStaticPaths so new paths can be added

* adds revalidate to staticProps

* updates for cache revalidation on the frontend

* trigger cleanup

* fixes listing bug issue

* adds additional checks for unit type and priority

* new line

* Fix code style issues with Prettier

* adds listing view

* adds other views

* adds unitsAvailable to select

* updates to pass view as query param for list and by id

* removes comment

* Update CHANGELOG.md

* updates view test

* rename spec and remove log

* removes another log

* updates partner-role migration

* updates partner-role migration

* adds --runInBand --detectOpenHandles to backend test

* adds view param to applications e2e spec test that fetches listings

* updates default view to full and fixes housing-counselors bug

* view test update

Co-authored-by: Lint Action <lint-action@samuelmeuli.com>

* 1629/fcfs with date (bloom-housing#1680)

* 1629/fcfs with date

* changelog

* 1611/what to expect editable in listings management (bloom-housing#1681)

* 1611/what to expect editable

* fixup unit test

* changelog

* Make actions an optional prop and hide the footer when not present. (bloom-housing#1690)

* Make features section more robust (bloom-housing#1688)

* Fixes whatToExpect UI Component failing test (bloom-housing#1692)

* force quit redis connection on app close

* updates for redis config

* adds enableShutdownHooks to main app

* Update archer-listing.ts

* Add migration (bloom-housing#1689)

Co-authored-by: seanmalbert <smabert@gmail.com>

* Fix code style issues with Prettier

* adds SRO to num_bedroom case

* 872/allow for unit sets to have multiple ami charts (bloom-housing#1678)

* Updates cache clear to use reset, instead of maintaining cache keys (bloom-housing#1698)

* force quit redis connection on app close

* updates for redis config

* adds enableShutdownHooks to main app

* Update archer-listing.ts

* Updates cache clear to use cacheManager reset, so we don't have to maintain keys

* Update units-transformations.ts

* Update CHANGELOG.md

* allows for not needing google api keys

* Update listings.controller.ts

* Update listings.e2e-spec.ts

* testing build issues (bloom-housing#1699)

* testing build issues

* testing build issues pt 2

* Updates translations to check for values before sending to service

Co-authored-by: seanmalbert <smabert@gmail.com>

* 1656/lottery type without explicit date (bloom-housing#1682)

* Add two lines to the LeasingAgent UI component to display information about the listing management company (bloom-housing#1677)

* Fix code style issues with Prettier

* 1402/multiple statuses under image card (bloom-housing#1700)

Co-authored-by: Anthony Kong <anthony.kong@sfgov.org>

* fix application routing (bloom-housing#1715)

* fix-applications-url

* changelog

Co-authored-by: Sean Albert <smabert@gmail.com>
Co-authored-by: Abbie Farr <afarr@google.com>
Co-authored-by: Abbie Farr <83078310+abbiefarr@users.noreply.github.com>
Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
Co-authored-by: Jared White <jared@jaredwhite.com>
Co-authored-by: pfeeny5 <82653098+pfeeny5@users.noreply.github.com>
Co-authored-by: Austin Valeske <avaleske@users.noreply.github.com>
Co-authored-by: Marcin Jędras <mjjedras@gmail.com>
Co-authored-by: Will Lin <4317058+willrlin@users.noreply.github.com>
Co-authored-by: Anders Schneider <anderseschneider@gmail.com>
Co-authored-by: Anthony Kong <anthony.kong@sfgov.org>
  • Loading branch information
12 people authored Aug 24, 2021
1 parent 0ea2c07 commit 2a2a8cc
Show file tree
Hide file tree
Showing 28 changed files with 247 additions and 74 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ All notable changes to this project will be documented in this file. The format
- Fixed:
- Update Listings component to sort listings by status ([#1585](https://github.com/bloom-housing/bloom/pull/1585))
- Preferences ordinal bug in listings management ([#1641](https://github.com/bloom-housing/bloom/pull/1641)) (Emily Jablonski)
- Routing to individual application ([#1715](https://github.com/bloom-housing/bloom/pull/1715)) (Emily Jablonski)

### UI Components

- Added:

- Add ResponsiveTable for pricing
- Ability to have multiple statuses under the ImageCard ([#1700](https://github.com/bloom-housing/bloom/pull/1700)) (Emily Jablonski)
- **Breaking Change**: Removed three props (appStatus, appStatusContent, and appStatusSubContent) in favor of an array that contains that data - will need to transition any status information to the new array format

- Fixed:
- StandardTable styling bug ([#1632](https://github.com/bloom-housing/bloom/pull/1632)) (Emily Jablonski)
Expand Down
13 changes: 0 additions & 13 deletions backend/core/src/listings/dto/listing.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import { JurisdictionDto } from "../../jurisdictions/dto/jurisdiction.dto"
import { ReservedCommunityTypeDto } from "../../reserved-community-type/dto/reserved-community-type.dto"
import { AssetCreateDto, AssetDto, AssetUpdateDto } from "../../assets/dto/asset.dto"
import { ApplicationMethodDto } from "../../application-methods/dto/application-method.dto"
import { ListingReviewOrder } from "../types/listing-review-order-enum"
import { ListingEventType } from "../types/listing-event-type-enum"
import { ListingEventCreateDto, ListingEventDto, ListingEventUpdateDto } from "./listing-event.dto"
import { listingUrlSlug } from "../../shared/url-helper"

Expand Down Expand Up @@ -147,15 +145,6 @@ export class ListingDto extends OmitType(Listing, [
)
status: ListingStatus

@Expose()
@ApiProperty({ enum: ListingReviewOrder })
get reviewOrderType() {
if (!this.events) return []
return this.events.some((event) => event.type === ListingEventType.publicLottery)
? ListingReviewOrder.lottery
: ListingReviewOrder.firstComeFirstServe
}

@Expose()
@Type(() => UnitDto)
@Transform(
Expand Down Expand Up @@ -346,7 +335,6 @@ export class ListingCreateDto extends OmitType(ListingDto, [
"leasingAgents",
"urlSlug",
"showWaitlist",
"reviewOrderType",
"units",
"accessibility",
"amenities",
Expand Down Expand Up @@ -539,7 +527,6 @@ export class ListingUpdateDto extends OmitType(ListingDto, [
"urlSlug",
"leasingAgents",
"showWaitlist",
"reviewOrderType",
"units",
"accessibility",
"amenities",
Expand Down
11 changes: 11 additions & 0 deletions backend/core/src/listings/entities/listing.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { Address } from "../../shared/entities/address.entity"
import { ApplicationMethod } from "../../application-methods/entities/application-method.entity"
import { UnitsSummarized } from "../../units/types/units-summarized"
import { UnitsSummary } from "../../units-summary/entities/units-summary.entity"
import { ListingReviewOrder } from "../types/listing-review-order-enum"

@Entity({ name: "listings" })
class Listing extends BaseEntity {
Expand Down Expand Up @@ -366,6 +367,16 @@ class Listing extends BaseEntity {
@ApiProperty({ enum: ListingStatus, enumName: "ListingStatus" })
status: ListingStatus

@Column({ type: "enum", enum: ListingReviewOrder, nullable: true })
@Expose()
@IsOptional({ groups: [ValidationsGroupsEnum.default] })
@IsEnum(ListingReviewOrder, { groups: [ValidationsGroupsEnum.default] })
@ApiProperty({
enum: ListingReviewOrder,
enumName: "ListingReviewOrder",
})
reviewOrderType?: ListingReviewOrder | null

@Expose()
applicationConfig?: Record<string, unknown>

Expand Down
1 change: 1 addition & 0 deletions backend/core/src/listings/views/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const views: Views = {
"listings.applicationDueDate",
"listings.applicationDueTime",
"listings.applicationOpenDate",
"listings.reviewOrderType",
"listings.status",
"listings.waitlistMaxSize",
"listings.waitlistCurrentSize",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class makeReviewOrderNotComputed1629225078065 implements MigrationInterface {
name = "makeReviewOrderNotComputed1629225078065"

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TYPE "listings_review_order_type_enum" AS ENUM('lottery', 'firstComeFirstServe')`
)
await queryRunner.query(
`ALTER TABLE "listings" ADD "review_order_type" "listings_review_order_type_enum"`
)

const listingsIDsWithoutReviewOrderType = await queryRunner.query(
"SELECT id FROM listings WHERE review_order_type IS NULL"
)

for (const listing of listingsIDsWithoutReviewOrderType) {
const listingEventTypes = await queryRunner.query(
`SELECT type FROM listing_events WHERE listing_id = '${listing.id}'`
)
if (listingEventTypes.some((eventType) => eventType.type === "publicLottery")) {
await queryRunner.query(
`UPDATE listings SET review_order_type = 'lottery' where id = '${listing.id}'`
)
} else {
await queryRunner.query(
`UPDATE listings SET review_order_type = 'firstComeFirstServe' where id = '${listing.id}'`
)
}
}
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "listings" DROP COLUMN "review_order_type"`)
await queryRunner.query(`DROP TYPE "listings_review_order_type_enum"`)
}
}
2 changes: 2 additions & 0 deletions backend/core/src/seeds/listings/listing-coliseum-seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { BaseEntity, DeepPartial } from "typeorm"
import { UnitCreateDto } from "../../units/dto/unit.dto"
import { ListingDefaultSeed } from "./listing-default-seed"
import { UnitStatus } from "../../units/types/unit-status-enum"
import { ListingReviewOrder } from "../../listings/types/listing-review-order-enum"

const coliseumProperty: PropertySeedType = {
accessibility:
Expand Down Expand Up @@ -934,6 +935,7 @@ const coliseumListing: ListingSeedType = {
rentalHistory: "Two years' landlord history or homeless verification",
requiredDocuments:
"Application Document Checklist: https://org-housingbayarea-public-assets.s3-us-west-1.amazonaws.com/Tax+Credit+Application+Interview+Checklist.pdf",
reviewOrderType: "firstComeFirstServe" as ListingReviewOrder,
specialNotes:
"Priority Units: 3 apartments are set-aside for households eligible for the HOPWA program (Housing Opportunities for Persons with AIDS), which are households where a person has been medically diagnosed with HIV/AIDS. These 3 apartments also have Project-Based Section rental subsidies (tenant pays 30% of household income). 15 apartments are for those with mobility impairments and one of these units also has features for the hearing/visually impaired. Two additional apartments have features for the hearing/visually impaired. All units require eligibility requirements beyond income qualification: The waiting list will be ordered by incorporating the Alameda County preference for eligible households in which at least one member lives or works in the County. Three (3) apartments are restricted to households eligible under the HOPWA (Housing Opportunities for Persons with AIDS), which are households where a person has been medically diagnosed with HIV/AIDS. These apartments also receive PBV’s from OHA. For the twenty-five (25) apartments that have Project-Based Section 8 Vouchers from OHA, applicants will be called for an interview in the order according to the site-based waiting list compiled from the initial application and lotter process specifically for the PBV units. The waiting list order for these apartments will also incorporate the local preferences required by OHA. These preferences are: * A Residency preference (Applicants who live or work in the City of Oakland at the time of the application interview and/or applicants that lived or worked in the City of Oakland at the time of submitting their initial application and can verify their previous residency/employment at the applicant interview, qualify for this preference). * A Family preference (Applicant families with two or more persons, or a single person applicant that is 62 years of age or older, or a single person applicant with a disability, qualify for this preference). * A Veteran and active members of the military preference. Per OHA policy, a Veteran is a person who served in the active military, naval, or air service and who was discharged or released from such service under conditions other than dishonorable. * A Homeless preference. Applicant families who meet the McKinney-Vento Act definition of homeless qualify for this preference (see definition below). Each PBV applicant will receive one point for each preference for which it is eligible and the site-based PBV waiting list will be prioritized by the number of points applicants have from these preferences. Applicants for the PBV units must comply with OHA’s policy regarding Social Security Numbers. The applicant and all members of the applicant’s household must disclose the complete and accurate social security number (SSN) assigned to each household member, and they must provide the documentation necessary to verify each SSN. As an EveryOne Home partner, each applicant’s individual circumstances will be evaluated, alternative forms of verification and additional information submitted by the applicant will considered, and reasonable accommodations will be provided when requested and if verified and necessary. Persons with disabilities are encouraged to apply.",
status: ListingStatus.active,
Expand Down
2 changes: 2 additions & 0 deletions backend/core/src/seeds/listings/listing-default-fcfs-seed.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ListingDefaultSeed } from "./listing-default-seed"
import { ListingReviewOrder } from "../../listings/types/listing-review-order-enum"

export class ListingDefaultFCFSSeed extends ListingDefaultSeed {
async seed() {
const listing = await super.seed()
return await this.listingRepository.save({
...listing,
name: "Test: Default, FCFS",
reviewOrderType: "firstComeFirstServe" as ListingReviewOrder,
applicationDueDate: null,
events: [],
})
Expand Down
2 changes: 2 additions & 0 deletions backend/core/src/seeds/listings/listing-triton-seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { UnitCreateDto } from "../../units/dto/unit.dto"
import { BaseEntity, DeepPartial } from "typeorm"
import { Listing } from "../../listings/entities/listing.entity"
import { UnitStatus } from "../../units/types/unit-status-enum"
import { ListingReviewOrder } from "../../listings/types/listing-review-order-enum"

export const tritonAmiChart: AmiChartCreateDto = {
name: "San Jose TCAC 2019",
Expand Down Expand Up @@ -742,6 +743,7 @@ const tritonListing: ListingSeedType = {
rentalHistory: "No evictions",
requiredDocuments:
"Due at interview - Paystubs, 3 months’ bank statements, recent tax returns or non-tax affidavit, recent retirement statement, application to lease, application qualifying criteria, social security card, state or nation ID. For self-employed, copy of IRS Tax Return including schedule C and current or most recent clients. Unemployment if applicable. Child support/Alimony; current notice from DA office, a court order or a letter from the provider with copies of last two checks. Any other income etc",
reviewOrderType: "firstComeFirstServe" as ListingReviewOrder,
specialNotes: null,
status: ListingStatus.active,
waitlistCurrentSize: 400,
Expand Down
2 changes: 2 additions & 0 deletions backend/core/src/seeds/listings/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ListingEventType } from "../../listings/types/listing-event-type-enum"
import { AmiChartCreateDto } from "../../ami-charts/dto/ami-chart.dto"
import { ListingEventCreateDto } from "../../listings/dto/listing-event.dto"
import { UnitStatus } from "../../units/types/unit-status-enum"
import { ListingReviewOrder } from "../../listings/types/listing-review-order-enum"

export const getDate = (days: number) => {
const someDate = new Date()
Expand Down Expand Up @@ -507,6 +508,7 @@ export const defaultListing: ListingSeedType = {
rentalAssistance: "Custom rental assistance text",
rentalHistory: "Custom rental history text",
requiredDocuments: "Custom required documents text",
reviewOrderType: "lottery" as ListingReviewOrder,
specialNotes: "Custom special notes text",
status: ListingStatus.active,
waitlistCurrentSize: null,
Expand Down
8 changes: 7 additions & 1 deletion backend/core/types/src/backend-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4086,7 +4086,7 @@ export interface Listing {
showWaitlist: boolean

/** */
reviewOrderType: EnumListingReviewOrderType
reviewOrderType?: EnumListingReviewOrderType

/** */
applicationMethods: ApplicationMethod[]
Expand Down Expand Up @@ -4434,6 +4434,9 @@ export interface ListingCreate {
/** */
countyCode: CountyCode

/** */
reviewOrderType?: EnumListingReviewOrderType

/** */
applicationMethods: Id[]

Expand Down Expand Up @@ -4798,6 +4801,9 @@ export interface ListingUpdate {
/** */
updatedAt?: Date

/** */
reviewOrderType?: EnumListingReviewOrderType

/** */
applicationMethods: Id[]

Expand Down
4 changes: 3 additions & 1 deletion sites/partners/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ export const getLotteryEvent = (listing: FormListing): ListingEvent | undefined
const lotteryEvents = listing?.events.filter(
(event) => event.type === ListingEventType.publicLottery
)
return lotteryEvents ? lotteryEvents[0] : null
return lotteryEvents && lotteryEvents.length && lotteryEvents[0].startTime
? lotteryEvents[0]
: null
}

// TODO memoize this function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ const DetailRankingsAndResults = () => {
const listing = useContext(ListingContext)

const lotteryEvent = getLotteryEvent(listing)

const getReviewOrderType = (): EnumListingReviewOrderType => {
return lotteryEvent
? EnumListingReviewOrderType.lottery
: EnumListingReviewOrderType.firstComeFirstServe
const getReviewOrderType = () => {
if (!listing.reviewOrderType) {
return lotteryEvent
? EnumListingReviewOrderType.lottery
: EnumListingReviewOrderType.firstComeFirstServe
} else {
return listing.reviewOrderType
}
}

return (
<GridSection
className="bg-primary-lighter"
Expand Down
15 changes: 13 additions & 2 deletions sites/partners/src/listings/PaperListingForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
ListingEventType,
ListingEventCreate,
Preference,
EnumListingReviewOrderType,
} from "@bloom-housing/backend-core/types"
import { YesNoAnswer } from "../../applications/PaperApplicationForm/FormTypes"
import moment from "moment"
Expand Down Expand Up @@ -192,7 +193,7 @@ const defaults: FormListing = {
yearBuilt: 2021,
urlSlug: undefined,
showWaitlist: false,
reviewOrderType: null,
reviewOrderType: EnumListingReviewOrderType.firstComeFirstServe,
unitsSummary: [],
unitsSummarized: {
unitTypes: [],
Expand Down Expand Up @@ -272,7 +273,13 @@ const formatFormData = (
const events: ListingEventCreate[] = data.events.filter(
(event) => !(event?.type === ListingEventType.publicLottery)
)
if (data.lotteryDate && data.reviewOrderQuestion === "reviewOrderLottery") {
if (
data.lotteryDate &&
data.lotteryDate.day &&
data.lotteryDate.month &&
data.lotteryDate.year &&
data.reviewOrderQuestion === "reviewOrderLottery"
) {
const startTime = createTime(createDate(data.lotteryDate), data.lotteryStartTime)
const endTime = createTime(createDate(data.lotteryDate), data.lotteryEndTime)

Expand Down Expand Up @@ -341,6 +348,10 @@ const formatFormData = (
: null,
events,
reservedCommunityType: data.reservedCommunityType.id ? data.reservedCommunityType : null,
reviewOrderType:
data.reviewOrderQuestion === "reviewOrderLottery"
? EnumListingReviewOrderType.lottery
: EnumListingReviewOrderType.firstComeFirstServe,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ const RankingsAndResults = ({ listing }: RankingsAndResultsProps) => {
label: t("listings.firstComeFirstServe"),
value: "reviewOrderFCFS",
id: "reviewOrderFCFS",
defaultChecked: !lotteryEvent,
defaultChecked:
!listing ||
listing?.reviewOrderType === EnumListingReviewOrderType.firstComeFirstServe,
},
{
label: t("listings.lottery"),
value: "reviewOrderLottery",
id: "reviewOrderLottery",
defaultChecked: lotteryEvent !== null && lotteryEvent !== undefined,
defaultChecked: listing?.reviewOrderType === EnumListingReviewOrderType.lottery,
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useEffect, useState, useContext } from "react"
import { AuthContext, RequireLogin, t, FormCard, dateToString } from "@bloom-housing/ui-components"
import Link from "next/link"
import FormSummaryDetails from "../../src/forms/applications/FormSummaryDetails"
import FormsLayout from "../../layouts/forms"
import FormSummaryDetails from "../../../src/forms/applications/FormSummaryDetails"
import FormsLayout from "../../../layouts/forms"
import { Application, Listing } from "@bloom-housing/backend-core/types"
import { useRouter } from "next/router"

Expand Down
2 changes: 1 addition & 1 deletion sites/public/pages/applications/start/choose-language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const ApplicationChooseLanguage = () => {
<ImageCard
title={listing.name}
imageUrl={imageUrl}
appStatusContent={appStatusContent}
statuses={[{ content: appStatusContent }]}
/>
</div>
)}
Expand Down
20 changes: 18 additions & 2 deletions ui-components/__tests__/blocks/ImageCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,26 @@ describe("<ImageCard>", () => {
imageUrl={"/images/listing.jpg"}
title={"My Building"}
subtitle={"The Address"}
appStatus={ApplicationStatusType.Closed}
appStatusContent={t("listings.applicationsClosed")}
statuses={[
{ status: ApplicationStatusType.Closed, content: t("listings.applicationsClosed") },
]}
/>
)
expect(getByText("Applications Closed", { exact: false })).not.toBeNull()
})
it("renders with multiple applications status bars", () => {
const { getByText } = render(
<ImageCard
imageUrl={"/images/listing.jpg"}
title={"My Building"}
subtitle={"The Address"}
statuses={[
{ status: ApplicationStatusType.Closed, content: "Applications Closed" },
{ status: ApplicationStatusType.PreLottery, content: "Lottery Results Posted Tomorrow" },
]}
/>
)
expect(getByText("Applications Closed", { exact: false })).not.toBeNull()
expect(getByText("Lottery Results Posted Tomorrow", { exact: false })).not.toBeNull()
})
})
25 changes: 25 additions & 0 deletions ui-components/__tests__/page_components/LeasingAgent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,29 @@ describe("<LeasingAgent>", () => {
listing.leasingAgentOfficeHours && queryByText(listing.leasingAgentOfficeHours)
).toBeNull()
})
it("does not show management company details if managementCompany prop is absent", () => {
const listing = Object.assign({}, ArcherListing) as Listing
const managementCompany = "Some Management Company"

const { queryByText } = render(<LeasingAgent listing={listing} />)
expect(queryByText(managementCompany)).toBeNull()
expect(queryByText("Website")).toBeNull()
})
it("shows management company details if managementCompany prop is present", () => {
const listing = Object.assign({}, ArcherListing) as Listing
const managementCompany = "Some Management Company"
const managementWebsite = "a fake management website url"

const { getByText } = render(
<LeasingAgent
listing={listing}
managementCompany={{
name: managementCompany,
website: managementWebsite,
}}
/>
)
expect(getByText(managementCompany)).toBeTruthy()
expect(getByText("Website")).toBeTruthy()
})
})
Loading

0 comments on commit 2a2a8cc

Please sign in to comment.