Skip to content

Commit ca56fe9

Browse files
committed
chore: test code
1 parent 7fc434d commit ca56fe9

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

tests-ui/tests/components/dialog/content/manager/NodeConflictDialogContent.test.ts

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ describe('NodeConflictDialogContent', () => {
138138
const wrapper = createWrapper()
139139

140140
expect(wrapper.text()).toContain('0')
141-
expect(wrapper.text()).toContain('Conflicts')
141+
// When there are no conflicts, the Conflicts section is not rendered (v-if)
142+
expect(wrapper.text()).not.toContain('Conflicts')
142143
expect(wrapper.text()).toContain('Extensions at Risk')
143144
expect(wrapper.find('[class*="Import Failed Extensions"]').exists()).toBe(
144145
false
@@ -185,18 +186,15 @@ describe('NodeConflictDialogContent', () => {
185186
const wrapper = createWrapper()
186187

187188
// Import Failed Extensions section should show 1 package
188-
const importFailedSection = wrapper.findAll(
189-
'.w-full.flex.flex-col.bg-base-background'
190-
)[0]
191-
expect(importFailedSection.text()).toContain('1')
192-
expect(importFailedSection.text()).toContain('Import Failed Extensions')
189+
const sections = wrapper.findAll(
190+
'[data-testid="conflict-dialog-panel-toggle"]'
191+
)
192+
expect(sections[0].text()).toContain('1')
193+
expect(sections[0].text()).toContain('Import Failed Extensions')
193194

194195
// Conflicts section should show 3 conflicts (excluding import_failed)
195-
const conflictsSection = wrapper.findAll(
196-
'.w-full.flex.flex-col.bg-base-background'
197-
)[1]
198-
expect(conflictsSection.text()).toContain('3')
199-
expect(conflictsSection.text()).toContain('Conflicts')
196+
expect(sections[1].text()).toContain('3')
197+
expect(sections[1].text()).toContain('Conflicts')
200198
})
201199
})
202200

@@ -244,8 +242,13 @@ describe('NodeConflictDialogContent', () => {
244242
// Click to expand conflicts panel
245243
await conflictsHeader.trigger('click')
246244

247-
// Should be expanded now
248-
const conflictItems = wrapper.findAll('.conflict-list-item')
245+
// Should be expanded now - check for expanded content
246+
const expandedPanels = wrapper.findAll(
247+
'[data-testid="conflict-dialog-panel-expanded"]'
248+
)
249+
expect(expandedPanels.length).toBeGreaterThan(0)
250+
// Should show conflict items
251+
const conflictItems = expandedPanels[0].findAll('.flex.h-6.flex-shrink-0')
249252
expect(conflictItems.length).toBeGreaterThan(0)
250253
})
251254

@@ -324,7 +327,10 @@ describe('NodeConflictDialogContent', () => {
324327
await conflictsHeader.trigger('click')
325328

326329
// Should display conflict messages (excluding import_failed)
327-
const conflictItems = wrapper.findAll('.conflict-list-item')
330+
const expandedPanel = wrapper.find(
331+
'[data-testid="conflict-dialog-panel-expanded"]'
332+
)
333+
const conflictItems = expandedPanel.findAll('.flex.h-6.flex-shrink-0')
328334
expect(conflictItems).toHaveLength(3) // 2 from Package1 + 1 from Package2
329335
})
330336

@@ -338,7 +344,10 @@ describe('NodeConflictDialogContent', () => {
338344
await importFailedHeader.trigger('click')
339345

340346
// Should display only import failed package
341-
const importFailedItems = wrapper.findAll('.conflict-list-item')
347+
const expandedPanel = wrapper.find(
348+
'[data-testid="conflict-dialog-panel-expanded"]'
349+
)
350+
const importFailedItems = expandedPanel.findAll('.flex.h-6.flex-shrink-0')
342351
expect(importFailedItems).toHaveLength(1)
343352
expect(importFailedItems[0].text()).toContain('Test Package 3')
344353
})
@@ -365,7 +374,8 @@ describe('NodeConflictDialogContent', () => {
365374
const wrapper = createWrapper()
366375

367376
expect(wrapper.text()).toContain('0')
368-
expect(wrapper.text()).toContain('Conflicts')
377+
// When there are no conflicts, the Conflicts section is not rendered (v-if)
378+
expect(wrapper.text()).not.toContain('Conflicts')
369379
expect(wrapper.text()).toContain('Extensions at Risk')
370380
// Import failed section should not be visible when there are no import failures
371381
expect(wrapper.text()).not.toContain('Import Failed Extensions')

0 commit comments

Comments
 (0)