Skip to content

Commit 62f2eae

Browse files
committed
Remove tests that rely on hard-coded values
1 parent e8f0a33 commit 62f2eae

File tree

2 files changed

+2
-60
lines changed

2 files changed

+2
-60
lines changed

test/nuxt/components/compare/FacetSelector.spec.ts

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -174,47 +174,6 @@ describe('FacetSelector', () => {
174174
})
175175
})
176176

177-
describe('comingSoon facets', () => {
178-
it('disables comingSoon facets', async () => {
179-
const component = await mountSuspended(FacetSelector)
180-
181-
// totalDependencies is marked as comingSoon
182-
const buttons = component.findAll('button')
183-
const comingSoonButton = buttons.find(b => b.text().includes('Total Deps'))
184-
185-
expect(comingSoonButton?.attributes('disabled')).toBeDefined()
186-
})
187-
188-
it('shows coming soon text for comingSoon facets', async () => {
189-
const component = await mountSuspended(FacetSelector)
190-
191-
expect(component.text().toLowerCase()).toContain('coming soon')
192-
})
193-
194-
it('does not show checkmark/add icon for comingSoon facets', async () => {
195-
const component = await mountSuspended(FacetSelector)
196-
197-
// Find the comingSoon button
198-
const buttons = component.findAll('button')
199-
const comingSoonButton = buttons.find(b => b.text().includes('Total Deps'))
200-
201-
// Should not have checkmark or add icon
202-
expect(comingSoonButton?.find('.i-carbon\\:checkmark').exists()).toBe(false)
203-
expect(comingSoonButton?.find('.i-carbon\\:add').exists()).toBe(false)
204-
})
205-
206-
it('does not call toggleFacet when comingSoon facet is clicked', async () => {
207-
const component = await mountSuspended(FacetSelector)
208-
209-
const buttons = component.findAll('button')
210-
const comingSoonButton = buttons.find(b => b.text().includes('Total Deps'))
211-
await comingSoonButton?.trigger('click')
212-
213-
// toggleFacet should not have been called with totalDependencies
214-
expect(mockToggleFacet).not.toHaveBeenCalledWith('totalDependencies')
215-
})
216-
})
217-
218177
describe('category all/none buttons', () => {
219178
it('calls selectCategory when all button is clicked', async () => {
220179
const component = await mountSuspended(FacetSelector)
@@ -242,13 +201,11 @@ describe('FacetSelector', () => {
242201

243202
it('disables all button when all facets in category are selected', async () => {
244203
// Select all performance facets
245-
const performanceFacets = FACETS_BY_CATEGORY.performance.filter(
204+
const performanceFacets: (string | ComparisonFacet)[] = FACETS_BY_CATEGORY.performance.filter(
246205
f => !FACET_INFO[f].comingSoon,
247206
)
248207
mockSelectedFacets.value = performanceFacets
249-
mockIsFacetSelected.mockImplementation((f: string) =>
250-
performanceFacets.includes(f as ComparisonFacet),
251-
)
208+
mockIsFacetSelected.mockImplementation((f: string) => performanceFacets.includes(f))
252209

253210
const component = await mountSuspended(FacetSelector)
254211

@@ -280,11 +237,5 @@ describe('FacetSelector', () => {
280237
// Selected facets have bg-bg-muted class
281238
expect(component.find('.bg-bg-muted').exists()).toBe(true)
282239
})
283-
284-
it('applies cursor-not-allowed to comingSoon facets', async () => {
285-
const component = await mountSuspended(FacetSelector)
286-
287-
expect(component.find('.cursor-not-allowed').exists()).toBe(true)
288-
})
289240
})
290241
})

test/nuxt/composables/use-facet-selection.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ describe('useFacetSelection', () => {
224224

225225
selectCategory('performance')
226226

227-
const performanceFacets = FACETS_BY_CATEGORY.performance.filter(
228-
f => f !== 'totalDependencies', // comingSoon facet
229-
)
230227
for (const facet of performanceFacets) {
231228
expect(isFacetSelected(facet)).toBe(true)
232229
}
@@ -369,12 +366,6 @@ describe('useFacetSelection', () => {
369366
expect(Array.isArray(allFacets)).toBe(true)
370367
expect(allFacets.length).toBeGreaterThan(0)
371368
})
372-
373-
it('allFacets includes all facets including comingSoon', async () => {
374-
const { allFacets } = await useFacetSelectionInComponent()
375-
376-
expect(allFacets).toContain('totalDependencies')
377-
})
378369
})
379370

380371
describe('whitespace handling', () => {

0 commit comments

Comments
 (0)