@@ -41,7 +41,7 @@ const categoryLabels: Record<string, string> = {
4141 security : 'Security & Compliance' ,
4242}
4343
44- const comingSoonFacetId = comingSoonFacets [ 0 ]
44+ const comingSoonFacetId : ComparisonFacet | undefined = comingSoonFacets . at ( 0 )
4545
4646// Helper to build facet info with labels
4747function buildFacetInfo ( facet : ComparisonFacet ) {
@@ -190,33 +190,35 @@ describe('FacetSelector', () => {
190190 } )
191191 } )
192192
193- describe . runIf ( hasComingSoonFacets ) ( 'comingSoon facets' , ( ) => {
194- it ( 'disables comingSoon facets' , async ( ) => {
195- const component = await mountSuspended ( FacetSelector )
193+ describe . runIf ( hasComingSoonFacets && comingSoonFacetId !== undefined ) (
194+ 'comingSoon facets' ,
195+ ( ) => {
196+ // runIf guarantees comingSoonFacetId is defined here
197+ const facetId : ComparisonFacet = comingSoonFacetId !
196198
197- const comingSoonInput = component . find (
198- `input[type="checkbox"][data-facet-id="${ comingSoonFacetId } "]` ,
199- )
200- expect ( comingSoonInput . attributes ( 'disabled' ) ) . toBeDefined ( )
201- } )
199+ it ( 'disables comingSoon facets' , async ( ) => {
200+ const component = await mountSuspended ( FacetSelector )
202201
203- it ( 'shows coming soon text for comingSoon facets' , async ( ) => {
204- const component = await mountSuspended ( FacetSelector )
202+ const comingSoonInput = component . find ( `input[type="checkbox"][data-facet-id="${ facetId } "]` )
203+ expect ( comingSoonInput . attributes ( 'disabled' ) ) . toBeDefined ( )
204+ } )
205205
206- expect ( component . text ( ) . toLowerCase ( ) ) . toContain ( ' coming soon' )
207- } )
206+ it ( 'shows coming soon text for comingSoon facets' , async ( ) => {
207+ const component = await mountSuspended ( FacetSelector )
208208
209- it ( 'does not call toggleFacet when comingSoon checkbox change is triggered' , async ( ) => {
210- const component = await mountSuspended ( FacetSelector )
209+ expect ( component . text ( ) . toLowerCase ( ) ) . toContain ( 'coming soon' )
210+ } )
211211
212- const comingSoonInput = component . find (
213- `input[type="checkbox"][data-facet-id="${ comingSoonFacetId } "]` ,
214- )
215- await comingSoonInput . trigger ( 'change' )
212+ it ( 'does not call toggleFacet when comingSoon checkbox change is triggered' , async ( ) => {
213+ const component = await mountSuspended ( FacetSelector )
216214
217- expect ( mockToggleFacet ) . not . toHaveBeenCalledWith ( comingSoonFacetId )
218- } )
219- } )
215+ const comingSoonInput = component . find ( `input[type="checkbox"][data-facet-id="${ facetId } "]` )
216+ await comingSoonInput . trigger ( 'change' )
217+
218+ expect ( mockToggleFacet ) . not . toHaveBeenCalledWith ( facetId )
219+ } )
220+ } ,
221+ )
220222
221223 describe ( 'category all/none buttons' , ( ) => {
222224 it ( 'calls selectCategory when all button is clicked' , async ( ) => {
0 commit comments