|
1 | 1 | import React from "react" |
2 | 2 | import { render, cleanup, screen } from "@testing-library/react" |
3 | 3 | import { Neighborhood } from "../../../../src/components/listing/listing_sections/Neighborhood" |
4 | | -import { NeighborhoodAmenitiesEnum } from "@bloom-housing/shared-helpers/src/types/backend-swagger" |
| 4 | +import { |
| 5 | + FeatureFlagEnum, |
| 6 | + Jurisdiction, |
| 7 | + NeighborhoodAmenitiesEnum, |
| 8 | +} from "@bloom-housing/shared-helpers/src/types/backend-swagger" |
5 | 9 |
|
6 | 10 | afterEach(cleanup) |
7 | 11 |
|
@@ -112,4 +116,49 @@ describe("<Neighborhood>", () => { |
112 | 116 | expect(screen.queryByText("School")).toBeNull() |
113 | 117 | expect(screen.queryByText("Health center")).toBeNull() |
114 | 118 | }) |
| 119 | + |
| 120 | + it("shows neighborhood amenities copy when enableNeighborhoodAmenitiesDropdown flag is enabled", () => { |
| 121 | + render( |
| 122 | + <Neighborhood |
| 123 | + address={{ |
| 124 | + id: "id", |
| 125 | + createdAt: new Date(), |
| 126 | + updatedAt: new Date(), |
| 127 | + city: "Address city", |
| 128 | + street: "Address street", |
| 129 | + street2: "Address unit", |
| 130 | + zipCode: "67890", |
| 131 | + state: "CA", |
| 132 | + latitude: 1, |
| 133 | + longitude: 2, |
| 134 | + }} |
| 135 | + name={"Listing name"} |
| 136 | + neighborhood={"Westend"} |
| 137 | + region={"Downtown"} |
| 138 | + neighborhoodAmenities={{ groceryStores: "Four blocks", pharmacies: "Two blocks" }} |
| 139 | + visibleNeighborhoodAmenities={[ |
| 140 | + NeighborhoodAmenitiesEnum.groceryStores, |
| 141 | + NeighborhoodAmenitiesEnum.pharmacies, |
| 142 | + ]} |
| 143 | + jurisdiction={ |
| 144 | + { |
| 145 | + id: "jurisdiction1", |
| 146 | + featureFlags: [ |
| 147 | + { name: FeatureFlagEnum.enableNeighborhoodAmenitiesDropdown, value: true }, |
| 148 | + ], |
| 149 | + } as unknown as Jurisdiction |
| 150 | + } |
| 151 | + /> |
| 152 | + ) |
| 153 | + expect(screen.getByRole("heading", { name: "Resources in the area", level: 3 })).toBeDefined() |
| 154 | + expect( |
| 155 | + screen.getByText( |
| 156 | + "The neighborhood around this property offers access to the following services and community resources:" |
| 157 | + ) |
| 158 | + ).toBeDefined() |
| 159 | + expect(screen.getByRole("heading", { name: "Grocery stores", level: 4 })).toBeDefined() |
| 160 | + expect(screen.getByText("Four blocks")).toBeDefined() |
| 161 | + expect(screen.getByRole("heading", { name: "Pharmacies", level: 4 })).toBeDefined() |
| 162 | + expect(screen.getByText("Two blocks")).toBeDefined() |
| 163 | + }) |
115 | 164 | }) |
0 commit comments