Skip to content

Commit ccd741b

Browse files
committed
test: fix assertions
1 parent 019cabe commit ccd741b

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,23 +129,23 @@ describe('FacetSelector', () => {
129129

130130
// totalDependencies is marked as comingSoon
131131
const buttons = component.findAll('button')
132-
const comingSoonButton = buttons.find(b => b.text().includes('Total Dependencies'))
132+
const comingSoonButton = buttons.find(b => b.text().includes('# Total Deps'))
133133

134134
expect(comingSoonButton?.attributes('disabled')).toBeDefined()
135135
})
136136

137137
it('shows coming soon text for comingSoon facets', async () => {
138138
const component = await mountSuspended(FacetSelector)
139139

140-
expect(component.text()).toContain('coming soon')
140+
expect(component.text().toLowerCase()).toContain('coming soon')
141141
})
142142

143143
it('does not show checkmark/add icon for comingSoon facets', async () => {
144144
const component = await mountSuspended(FacetSelector)
145145

146146
// Find the comingSoon button
147147
const buttons = component.findAll('button')
148-
const comingSoonButton = buttons.find(b => b.text().includes('Total Dependencies'))
148+
const comingSoonButton = buttons.find(b => b.text().includes('# Total Deps'))
149149

150150
// Should not have checkmark or add icon
151151
expect(comingSoonButton?.find('.i-carbon\\:checkmark').exists()).toBe(false)
@@ -156,7 +156,7 @@ describe('FacetSelector', () => {
156156
const component = await mountSuspended(FacetSelector)
157157

158158
const buttons = component.findAll('button')
159-
const comingSoonButton = buttons.find(b => b.text().includes('Total Dependencies'))
159+
const comingSoonButton = buttons.find(b => b.text().includes('# Total Deps'))
160160
await comingSoonButton?.trigger('click')
161161

162162
// toggleFacet should not have been called with totalDependencies
@@ -176,6 +176,10 @@ describe('FacetSelector', () => {
176176
})
177177

178178
it('calls deselectCategory when none button is clicked', async () => {
179+
// Select a performance facet so 'none' button is enabled
180+
mockSelectedFacets.value = ['packageSize']
181+
mockIsFacetSelected.mockImplementation((f: string) => f === 'packageSize')
182+
179183
const component = await mountSuspended(FacetSelector)
180184

181185
// Find the first 'none' button (for performance category)

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ describe('MetricRow', () => {
3333
description: 'Number of downloads per week',
3434
},
3535
})
36-
expect(component.find('.i-carbon-information').exists()).toBe(true)
36+
expect(component.find('.i-carbon\\:information').exists()).toBe(true)
3737
})
3838

3939
it('does not render description icon when not provided', async () => {
4040
const component = await mountSuspended(MetricRow, {
4141
props: baseProps,
4242
})
43-
expect(component.find('.i-carbon-information').exists()).toBe(false)
43+
expect(component.find('.i-carbon\\:information').exists()).toBe(false)
4444
})
4545
})
4646

@@ -79,7 +79,7 @@ describe('MetricRow', () => {
7979
loading: true,
8080
},
8181
})
82-
expect(component.find('.i-carbon-circle-dash').exists()).toBe(true)
82+
expect(component.find('.i-carbon\\:circle-dash').exists()).toBe(true)
8383
})
8484
})
8585

@@ -195,7 +195,7 @@ describe('MetricRow', () => {
195195
diffs: [null, { direction: 'increase', display: '+100%', favorable: true }],
196196
},
197197
})
198-
expect(component.find('.i-carbon-arrow-up').exists()).toBe(true)
198+
expect(component.find('.i-carbon\\:arrow-up').exists()).toBe(true)
199199
expect(component.text()).toContain('+100%')
200200
})
201201

@@ -210,7 +210,7 @@ describe('MetricRow', () => {
210210
diffs: [null, { direction: 'decrease', display: '-50%', favorable: false }],
211211
},
212212
})
213-
expect(component.find('.i-carbon-arrow-down').exists()).toBe(true)
213+
expect(component.find('.i-carbon\\:arrow-down').exists()).toBe(true)
214214
})
215215

216216
it('applies favorable diff styling (green)', async () => {
@@ -254,8 +254,8 @@ describe('MetricRow', () => {
254254
diffs: [null, { direction: 'same', display: '0%', favorable: undefined }],
255255
},
256256
})
257-
expect(component.find('.i-carbon-arrow-up').exists()).toBe(false)
258-
expect(component.find('.i-carbon-arrow-down').exists()).toBe(false)
257+
expect(component.find('.i-carbon\\:arrow-up').exists()).toBe(false)
258+
expect(component.find('.i-carbon\\:arrow-down').exists()).toBe(false)
259259
})
260260
})
261261

0 commit comments

Comments
 (0)