Skip to content

Commit 755232e

Browse files
committed
fix tests
1 parent d700642 commit 755232e

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

packages/devtools/src/tabs/marketplace/plugin-utils.test.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,11 @@ describe('groupIntoSections', () => {
223223

224224
const sections = groupIntoSections(cards)
225225

226-
expect(sections).toHaveLength(1)
227-
expect(sections[0]?.id).toBe('active')
228-
expect(sections[0]?.displayName).toBe('✓ Active Plugins')
229-
expect(sections[0]?.cards).toHaveLength(1)
226+
expect(sections).toHaveLength(2) // Featured (always present) + Active
227+
expect(sections[0]?.id).toBe('featured')
228+
expect(sections[1]?.id).toBe('active')
229+
expect(sections[1]?.displayName).toBe('✓ Active Plugins')
230+
expect(sections[1]?.cards).toHaveLength(1)
230231
})
231232

232233
it('should group featured plugins', () => {
@@ -266,9 +267,11 @@ describe('groupIntoSections', () => {
266267

267268
const sections = groupIntoSections(cards)
268269

269-
expect(sections).toHaveLength(1)
270-
expect(sections[0]?.id).toBe('active')
271-
expect(sections.find((s) => s.id === 'featured')).toBeUndefined()
270+
expect(sections).toHaveLength(2) // Featured (always present) + Active
271+
expect(sections[0]?.id).toBe('featured')
272+
expect(sections[1]?.id).toBe('active')
273+
expect(sections[0]?.cards).toHaveLength(0) // Featured section empty
274+
expect(sections[1]?.cards).toHaveLength(1) // Active has the plugin
272275
})
273276

274277
it('should group available plugins', () => {
@@ -286,9 +289,10 @@ describe('groupIntoSections', () => {
286289

287290
const sections = groupIntoSections(cards)
288291

289-
expect(sections).toHaveLength(1)
290-
expect(sections[0]?.id).toBe('available')
291-
expect(sections[0]?.displayName).toBe('Available Plugins')
292+
expect(sections).toHaveLength(2) // Featured (always present) + Available
293+
expect(sections[0]?.id).toBe('featured')
294+
expect(sections[1]?.id).toBe('available')
295+
expect(sections[1]?.displayName).toBe('Available Plugins')
292296
})
293297

294298
it('should not include featured plugins in available section', () => {
@@ -345,8 +349,8 @@ describe('groupIntoSections', () => {
345349
const sections = groupIntoSections(cards)
346350

347351
expect(sections).toHaveLength(3)
348-
expect(sections[0]?.id).toBe('active')
349-
expect(sections[1]?.id).toBe('featured')
352+
expect(sections[0]?.id).toBe('featured')
353+
expect(sections[1]?.id).toBe('active')
350354
expect(sections[2]?.id).toBe('available')
351355
})
352356

@@ -365,12 +369,16 @@ describe('groupIntoSections', () => {
365369

366370
const sections = groupIntoSections(cards)
367371

368-
expect(sections).toHaveLength(0)
372+
expect(sections).toHaveLength(1) // Only featured section (always present, empty)
373+
expect(sections[0]?.id).toBe('featured')
374+
expect(sections[0]?.cards).toHaveLength(0)
369375
})
370376

371377
it('should handle empty card array', () => {
372378
const sections = groupIntoSections([])
373-
expect(sections).toHaveLength(0)
379+
expect(sections).toHaveLength(1) // Featured section always present
380+
expect(sections[0]?.id).toBe('featured')
381+
expect(sections[0]?.cards).toHaveLength(0)
374382
})
375383
})
376384

0 commit comments

Comments
 (0)