resourceSidebar.test.ts 884 B

123456789101112131415161718192021222324
  1. import { mount } from '@vue/test-utils'
  2. import { describe, expect, it } from 'vitest'
  3. import ResourceSidebar from '@/components/app/ResourceSidebar.vue'
  4. describe('ResourceSidebar', () => {
  5. it('uses a neutral group placeholder without inventing members', () => {
  6. const wrapper = mount(ResourceSidebar, {
  7. props: {
  8. items: [
  9. { id: 'topic:room-1:topic-1', title: '话题一', topic: true, avatar: '', avatarFallbackKey: 'room-1' },
  10. { id: 'topic:room-1:topic-2', title: '话题二', topic: true, avatar: '', avatarFallbackKey: 'room-1' },
  11. ],
  12. },
  13. })
  14. const groups = wrapper.findAll('.team-avatar')
  15. expect(groups).toHaveLength(2)
  16. for (const group of groups) {
  17. expect(group.findAll('.team-avatar__member')).toHaveLength(0)
  18. expect(group.find('.app-icon').exists()).toBe(true)
  19. }
  20. wrapper.unmount()
  21. })
  22. })