@@ -9,10 +9,13 @@ import {
99 MultiselectQuestionsApplicationSectionEnum ,
1010 MultiselectQuestionsStatusEnum ,
1111} from "@bloom-housing/shared-helpers/src/types/backend-swagger"
12+ import {
13+ defaultListingFeaturesConfiguration ,
14+ expandedListingFeaturesConfiguration ,
15+ } from "@bloom-housing/shared-helpers/__tests__/testHelpers"
1216import { mockNextRouter , render } from "../../testUtils"
1317import { FilterDrawer } from "../../../src/components/browse/FilterDrawer"
1418import { FilterData } from "../../../src/components/browse/FilterDrawerHelpers"
15- import { defaultListingFeaturesConfiguration } from "@bloom-housing/shared-helpers/__tests__/testHelpers"
1619
1720describe ( "FilterDrawer" , ( ) => {
1821 beforeEach ( ( ) => {
@@ -67,6 +70,9 @@ describe("FilterDrawer", () => {
6770 filterState = { { } }
6871 multiselectData = { mockMultiselect }
6972 activeFeatureFlags = { [
73+ FeatureFlagEnum . enableIsVerified ,
74+ FeatureFlagEnum . enableHomeType ,
75+ FeatureFlagEnum . enableSection8Question ,
7076 FeatureFlagEnum . enableRegions ,
7177 FeatureFlagEnum . enableAccessibilityFeatures ,
7278 FeatureFlagEnum . enableParkingType ,
@@ -249,6 +255,9 @@ describe("FilterDrawer", () => {
249255 filterState = { filterState }
250256 multiselectData = { mockMultiselect }
251257 activeFeatureFlags = { [
258+ FeatureFlagEnum . enableIsVerified ,
259+ FeatureFlagEnum . enableHomeType ,
260+ FeatureFlagEnum . enableSection8Question ,
252261 FeatureFlagEnum . enableRegions ,
253262 FeatureFlagEnum . enableAccessibilityFeatures ,
254263 FeatureFlagEnum . enableParkingType ,
@@ -490,4 +499,118 @@ describe("FilterDrawer", () => {
490499
491500 expect ( screen . getByRole ( "group" , { name : "Region" } ) ) . toBeInTheDocument ( )
492501 } )
502+
503+ it ( "should not show confirmed listings section when isVerified flag is off" , ( ) => {
504+ render (
505+ < FilterDrawer
506+ isOpen = { true }
507+ onClose = { ( ) => { } }
508+ onSubmit = { ( ) => { } }
509+ onClear = { ( ) => { } }
510+ filterState = { { } }
511+ multiselectData = { mockMultiselect }
512+ activeFeatureFlags = { [ ] }
513+ listingFeaturesConfiguration = { defaultListingFeaturesConfiguration }
514+ />
515+ )
516+
517+ expect ( screen . queryByRole ( "group" , { name : "Confirmed listings" } ) ) . not . toBeInTheDocument ( )
518+ expect (
519+ screen . queryByRole ( "checkbox" , { name : "Only show listings confirmed by property" } )
520+ ) . not . toBeInTheDocument ( )
521+ } )
522+
523+ it ( "should not show home type section when homeType flag is off" , ( ) => {
524+ render (
525+ < FilterDrawer
526+ isOpen = { true }
527+ onClose = { ( ) => { } }
528+ onSubmit = { ( ) => { } }
529+ onClear = { ( ) => { } }
530+ filterState = { { } }
531+ multiselectData = { mockMultiselect }
532+ activeFeatureFlags = { [ ] }
533+ listingFeaturesConfiguration = { defaultListingFeaturesConfiguration }
534+ />
535+ )
536+
537+ expect ( screen . queryByRole ( "group" , { name : "Home type" } ) ) . not . toBeInTheDocument ( )
538+ expect ( screen . queryByRole ( "checkbox" , { name : "Apartment" } ) ) . not . toBeInTheDocument ( )
539+ } )
540+
541+ it ( "should not show parking types section when parkingType flag is off" , ( ) => {
542+ render (
543+ < FilterDrawer
544+ isOpen = { true }
545+ onClose = { ( ) => { } }
546+ onSubmit = { ( ) => { } }
547+ onClear = { ( ) => { } }
548+ filterState = { { } }
549+ multiselectData = { mockMultiselect }
550+ activeFeatureFlags = { [ ] }
551+ listingFeaturesConfiguration = { defaultListingFeaturesConfiguration }
552+ />
553+ )
554+
555+ expect ( screen . queryByRole ( "group" , { name : "Parking types" } ) ) . not . toBeInTheDocument ( )
556+ expect ( screen . queryByRole ( "checkbox" , { name : "Garage" } ) ) . not . toBeInTheDocument ( )
557+ } )
558+
559+ it ( "should not show section 8 checkbox when section8 flag is off" , ( ) => {
560+ render (
561+ < FilterDrawer
562+ isOpen = { true }
563+ onClose = { ( ) => { } }
564+ onSubmit = { ( ) => { } }
565+ onClear = { ( ) => { } }
566+ filterState = { { } }
567+ multiselectData = { mockMultiselect }
568+ activeFeatureFlags = { [ ] }
569+ listingFeaturesConfiguration = { defaultListingFeaturesConfiguration }
570+ />
571+ )
572+
573+ expect ( screen . getByRole ( "group" , { name : "Rent" } ) ) . toBeInTheDocument ( )
574+ expect (
575+ screen . queryByRole ( "checkbox" , { name : "Accepts Section 8 Housing Choice Vouchers" } )
576+ ) . not . toBeInTheDocument ( )
577+ } )
578+
579+ it ( "should not show accessibility section when accessibility flag is off" , ( ) => {
580+ render (
581+ < FilterDrawer
582+ isOpen = { true }
583+ onClose = { ( ) => { } }
584+ onSubmit = { ( ) => { } }
585+ onClear = { ( ) => { } }
586+ filterState = { { } }
587+ multiselectData = { mockMultiselect }
588+ activeFeatureFlags = { [ ] }
589+ listingFeaturesConfiguration = { defaultListingFeaturesConfiguration }
590+ />
591+ )
592+
593+ expect ( screen . queryByRole ( "group" , { name : "Accessibility features" } ) ) . not . toBeInTheDocument ( )
594+ expect ( screen . queryByLabelText ( "Wheelchair ramp" ) ) . not . toBeInTheDocument ( )
595+ } )
596+
597+ it ( "should show accessibility section and category groups when accessibility flag is on" , ( ) => {
598+ render (
599+ < FilterDrawer
600+ isOpen = { true }
601+ onClose = { ( ) => { } }
602+ onSubmit = { ( ) => { } }
603+ onClear = { ( ) => { } }
604+ filterState = { { } }
605+ multiselectData = { mockMultiselect }
606+ activeFeatureFlags = { [ FeatureFlagEnum . enableAccessibilityFeatures ] }
607+ listingFeaturesConfiguration = { expandedListingFeaturesConfiguration }
608+ />
609+ )
610+
611+ expect ( screen . getByRole ( "group" , { name : "Accessibility features" } ) ) . toBeInTheDocument ( )
612+ expect ( screen . getByRole ( "group" , { name : "Mobility" } ) ) . toBeInTheDocument ( )
613+ expect ( screen . getByRole ( "group" , { name : "Bathroom" } ) ) . toBeInTheDocument ( )
614+ expect ( screen . getByLabelText ( "Wheelchair ramp" ) ) . toBeInTheDocument ( )
615+ } )
493616} )
0 commit comments