resources/assets/js/components/screens/home/MostPlayedAlbums.spec.ts

Summary

Maintainability
B
4 hrs
Test Coverage
import { expect, it } from 'vitest'
import { overviewStore } from '@/stores'
import UnitTestCase from '@/__tests__/UnitTestCase'
import factory from '@/__tests__/factory'
import MostPlayedAlbums from './MostPlayedAlbums.vue'

new class extends UnitTestCase {
  protected test () {
    it('displays the albums', () => {
      overviewStore.state.mostPlayedAlbums = factory<Album>('album', 6)
      expect(this.render(MostPlayedAlbums, {
        global: {
          stubs: {
            AlbumCard: this.stub('album-card')
          }
        }
      }).getAllByTestId('album-card')).toHaveLength(6)
    })
  }
}