@@ -34,6 +34,16 @@ const categoryLabels: Record<string, string> = {
3434 security : 'Security & Compliance' ,
3535}
3636
37+ // ComingSoon tests run only when FACET_INFO has at least one comingSoon facet
38+ const comingSoonFacets = ( Object . keys ( FACET_INFO ) as ComparisonFacet [ ] ) . filter (
39+ f => FACET_INFO [ f ] . comingSoon ,
40+ )
41+ const hasComingSoonFacets = comingSoonFacets . length > 0
42+ const comingSoonFacetId = comingSoonFacets [ 0 ]
43+ const comingSoonFacetLabel = hasComingSoonFacets
44+ ? ( facetLabels [ comingSoonFacetId ! ] ?. label ?? comingSoonFacetId )
45+ : ''
46+
3747// Helper to build facet info with labels
3848function buildFacetInfo ( facet : ComparisonFacet ) {
3949 return {
@@ -174,13 +184,12 @@ describe('FacetSelector', () => {
174184 } )
175185 } )
176186
177- describe ( 'comingSoon facets' , ( ) => {
187+ describe . runIf ( hasComingSoonFacets ) ( 'comingSoon facets' , ( ) => {
178188 it ( 'disables comingSoon facets' , async ( ) => {
179189 const component = await mountSuspended ( FacetSelector )
180190
181- // totalDependencies is marked as comingSoon
182191 const buttons = component . findAll ( 'button' )
183- const comingSoonButton = buttons . find ( b => b . text ( ) . includes ( 'Total Deps' ) )
192+ const comingSoonButton = buttons . find ( b => b . text ( ) . includes ( comingSoonFacetLabel ) )
184193
185194 expect ( comingSoonButton ?. attributes ( 'disabled' ) ) . toBeDefined ( )
186195 } )
@@ -194,11 +203,9 @@ describe('FacetSelector', () => {
194203 it ( 'does not show checkmark/add icon for comingSoon facets' , async ( ) => {
195204 const component = await mountSuspended ( FacetSelector )
196205
197- // Find the comingSoon button
198206 const buttons = component . findAll ( 'button' )
199- const comingSoonButton = buttons . find ( b => b . text ( ) . includes ( 'Total Deps' ) )
207+ const comingSoonButton = buttons . find ( b => b . text ( ) . includes ( comingSoonFacetLabel ) )
200208
201- // Should not have checkmark or add icon
202209 expect ( comingSoonButton ?. find ( '.i-carbon\\:checkmark' ) . exists ( ) ) . toBe ( false )
203210 expect ( comingSoonButton ?. find ( '.i-carbon\\:add' ) . exists ( ) ) . toBe ( false )
204211 } )
@@ -207,11 +214,10 @@ describe('FacetSelector', () => {
207214 const component = await mountSuspended ( FacetSelector )
208215
209216 const buttons = component . findAll ( 'button' )
210- const comingSoonButton = buttons . find ( b => b . text ( ) . includes ( 'Total Deps' ) )
217+ const comingSoonButton = buttons . find ( b => b . text ( ) . includes ( comingSoonFacetLabel ) )
211218 await comingSoonButton ?. trigger ( 'click' )
212219
213- // toggleFacet should not have been called with totalDependencies
214- expect ( mockToggleFacet ) . not . toHaveBeenCalledWith ( 'totalDependencies' )
220+ expect ( mockToggleFacet ) . not . toHaveBeenCalledWith ( comingSoonFacetId )
215221 } )
216222 } )
217223
@@ -281,7 +287,7 @@ describe('FacetSelector', () => {
281287 expect ( component . find ( '.bg-bg-muted' ) . exists ( ) ) . toBe ( true )
282288 } )
283289
284- it ( 'applies cursor-not-allowed to comingSoon facets' , async ( ) => {
290+ it . runIf ( hasComingSoonFacets ) ( 'applies cursor-not-allowed to comingSoon facets' , async ( ) => {
285291 const component = await mountSuspended ( FacetSelector )
286292
287293 expect ( component . find ( '.cursor-not-allowed' ) . exists ( ) ) . toBe ( true )
0 commit comments