diff --git a/resources/assets/js/components/album/AlbumInfo.spec.ts b/resources/assets/js/components/album/AlbumInfo.spec.ts index e7e919df3e..b0156777ab 100644 --- a/resources/assets/js/components/album/AlbumInfo.spec.ts +++ b/resources/assets/js/components/album/AlbumInfo.spec.ts @@ -49,10 +49,10 @@ new class extends UnitTestCase { }) it('triggers showing full wiki for aside mode', async () => { - const { queryByTestId } = await this.renderComponent('aside') + const { getByTestId, queryByTestId } = await this.renderComponent('aside') expect(queryByTestId('full')).toBeNull() - await fireEvent.click(queryByTestId('more-btn')) + await fireEvent.click(getByTestId('more-btn')) expect(queryByTestId('summary')).toBeNull() expect(queryByTestId('full')).not.toBeNull() diff --git a/resources/assets/js/components/album/AlbumTrackListItem.spec.ts b/resources/assets/js/components/album/AlbumTrackListItem.spec.ts index 5833f8ca06..c17188c605 100644 --- a/resources/assets/js/components/album/AlbumTrackListItem.spec.ts +++ b/resources/assets/js/components/album/AlbumTrackListItem.spec.ts @@ -27,7 +27,7 @@ new class extends UnitTestCase { }, global: { provide: { - [SongsKey]: [ref(songsToMatchAgainst)] + [SongsKey]: [ref(songsToMatchAgainst)] } } }) diff --git a/resources/assets/js/components/artist/ArtistCard.spec.ts b/resources/assets/js/components/artist/ArtistCard.spec.ts index b67b4615da..95364c12c9 100644 --- a/resources/assets/js/components/artist/ArtistCard.spec.ts +++ b/resources/assets/js/components/artist/ArtistCard.spec.ts @@ -74,7 +74,7 @@ new class extends UnitTestCase { await this.tick() expect(fetchMock).toHaveBeenCalledWith(artist) - expect(playMock).toHaveBeenCalled(songs, true) + expect(playMock).toHaveBeenCalledWith(songs, true) }) } } diff --git a/resources/assets/js/components/artist/ArtistInfo.spec.ts b/resources/assets/js/components/artist/ArtistInfo.spec.ts index 8a5d4f9eff..8c6de158f0 100644 --- a/resources/assets/js/components/artist/ArtistInfo.spec.ts +++ b/resources/assets/js/components/artist/ArtistInfo.spec.ts @@ -7,7 +7,7 @@ import { fireEvent } from '@testing-library/vue' import { playbackService } from '@/services' import ArtistInfoComponent from './ArtistInfo.vue' -let artist: Album +let artist: Artist new class extends UnitTestCase { private async renderComponent (mode: MediaInfoDisplayMode = 'aside', info?: ArtistInfo) { @@ -43,10 +43,10 @@ new class extends UnitTestCase { }) it('triggers showing full bio for aside mode', async () => { - const { queryByTestId } = await this.renderComponent('aside') + const { queryByTestId, getByTestId } = await this.renderComponent('aside') expect(queryByTestId('full')).toBeNull() - await fireEvent.click(queryByTestId('more-btn')) + await fireEvent.click(getByTestId('more-btn')) expect(queryByTestId('summary')).toBeNull() expect(queryByTestId('full')).not.toBeNull() diff --git a/resources/assets/js/components/playlist/CreatePlaylistForm.spec.ts b/resources/assets/js/components/playlist/CreatePlaylistForm.spec.ts index d8724c0d68..618c4ecf3d 100644 --- a/resources/assets/js/components/playlist/CreatePlaylistForm.spec.ts +++ b/resources/assets/js/components/playlist/CreatePlaylistForm.spec.ts @@ -8,7 +8,7 @@ import CreatePlaylistForm from './CreatePlaylistForm.vue' new class extends UnitTestCase { protected test () { it('submits', async () => { - const storeMock = this.mock(playlistStore, 'store').mockResolvedValue(factory('playlist')) + const storeMock = this.mock(playlistStore, 'store').mockResolvedValue(factory('playlist')) const { getByPlaceholderText, getByRole } = await this.render(CreatePlaylistForm) await fireEvent.update(getByPlaceholderText('Playlist name'), 'My playlist') diff --git a/resources/assets/js/components/screens/ArtistListScreen.spec.ts b/resources/assets/js/components/screens/ArtistListScreen.spec.ts index 88d50503bc..6411bbbda9 100644 --- a/resources/assets/js/components/screens/ArtistListScreen.spec.ts +++ b/resources/assets/js/components/screens/ArtistListScreen.spec.ts @@ -31,7 +31,7 @@ new class extends UnitTestCase { it.each<[ArtistAlbumViewMode]>([['list'], ['thumbnails']])('sets layout:%s from preferences', async (mode) => { preferenceStore.artistsViewMode = mode - const { getByTestId, html } = this.renderComponent() + const { getByTestId } = this.renderComponent() await waitFor(() => expect(getByTestId('artist-list').classList.contains(`as-${mode}`)).toBe(true)) }) diff --git a/resources/assets/js/services/authService.spec.ts b/resources/assets/js/services/authService.spec.ts index 94f02c30af..07fc2c7cca 100644 --- a/resources/assets/js/services/authService.spec.ts +++ b/resources/assets/js/services/authService.spec.ts @@ -1,7 +1,7 @@ import UnitTestCase from '@/__tests__/UnitTestCase' import { localStorageService } from '@/services/localStorageService' -import { authService } from '@/services/authService' import { expect, it } from 'vitest' +import { authService } from './authService' new class extends UnitTestCase { protected test () { diff --git a/resources/assets/js/services/cache.spec.ts b/resources/assets/js/services/cache.spec.ts index 90687e563e..dd08e26afc 100644 --- a/resources/assets/js/services/cache.spec.ts +++ b/resources/assets/js/services/cache.spec.ts @@ -1,6 +1,6 @@ import { expect, it, vi } from 'vitest' import UnitTestCase from '@/__tests__/UnitTestCase' -import { Cache } from '@/services/cache' +import { Cache } from './cache' let cache: Cache diff --git a/resources/assets/js/services/downloadService.spec.ts b/resources/assets/js/services/downloadService.spec.ts index 321dc4b0fd..ff4fed61a9 100644 --- a/resources/assets/js/services/downloadService.spec.ts +++ b/resources/assets/js/services/downloadService.spec.ts @@ -40,7 +40,7 @@ new class extends UnitTestCase { 'downloads favorites if available', (songs, triggered) => { const mock = this.mock(downloadService, 'trigger') - favoriteStore.all = songs + favoriteStore.state.songs = songs downloadService.fromFavorites() diff --git a/resources/assets/js/services/mediaInfoService.spec.ts b/resources/assets/js/services/mediaInfoService.spec.ts index b2d4c1edbe..5ba5a7b4af 100644 --- a/resources/assets/js/services/mediaInfoService.spec.ts +++ b/resources/assets/js/services/mediaInfoService.spec.ts @@ -3,7 +3,7 @@ import factory from '@/__tests__/factory' import UnitTestCase from '@/__tests__/UnitTestCase' import { cache, httpService } from '@/services' import { albumStore, artistStore } from '@/stores' -import { mediaInfoService } from '@/services/mediaInfoService' +import { mediaInfoService } from './mediaInfoService' new class extends UnitTestCase { protected test () { diff --git a/resources/assets/js/services/playbackService.spec.ts b/resources/assets/js/services/playbackService.spec.ts index 5586a2d5ca..fb1be76c3e 100644 --- a/resources/assets/js/services/playbackService.spec.ts +++ b/resources/assets/js/services/playbackService.spec.ts @@ -1,3 +1,4 @@ +import { nextTick, reactive } from 'vue' import plyr from 'plyr' import lodash from 'lodash' import { expect, it, vi } from 'vitest' @@ -5,7 +6,6 @@ import { eventBus, noop } from '@/utils' import router from '@/router' import factory from '@/__tests__/factory' import UnitTestCase from '@/__tests__/UnitTestCase' -import { nextTick, reactive } from 'vue' import { socketService } from '@/services' import { playbackService } from './playbackService' diff --git a/resources/assets/js/services/uploadService.ts b/resources/assets/js/services/uploadService.ts index 0ae0c49e86..753389f0d9 100644 --- a/resources/assets/js/services/uploadService.ts +++ b/resources/assets/js/services/uploadService.ts @@ -1,6 +1,6 @@ import { without } from 'lodash' import { reactive } from 'vue' -import { UploadFile, UploadStatus } from '@/config' +import { UploadFile } from '@/config' import { httpService } from '@/services' import { albumStore, overviewStore, songStore } from '@/stores' import { logger } from '@/utils' @@ -102,9 +102,5 @@ export const uploadService = { removeFailed () { this.state.files = this.state.files.filter(file => file.status !== 'Errored') - }, - - getFilesByStatus (status: UploadStatus) { - return this.state.files.filter(file => file.status === status) } } diff --git a/resources/assets/js/stores/albumStore.spec.ts b/resources/assets/js/stores/albumStore.spec.ts index d3285ecf41..8fe3e712e7 100644 --- a/resources/assets/js/stores/albumStore.spec.ts +++ b/resources/assets/js/stores/albumStore.spec.ts @@ -1,8 +1,8 @@ import { expect, it } from 'vitest' import UnitTestCase from '@/__tests__/UnitTestCase' -import { albumStore, songStore } from '@/stores' import factory from '@/__tests__/factory' import { httpService } from '@/services' +import { albumStore, songStore } from '.' new class extends UnitTestCase { protected beforeEach () { diff --git a/resources/assets/js/stores/artistStore.spec.ts b/resources/assets/js/stores/artistStore.spec.ts index 1965810f03..055e028776 100644 --- a/resources/assets/js/stores/artistStore.spec.ts +++ b/resources/assets/js/stores/artistStore.spec.ts @@ -1,8 +1,8 @@ import { expect, it } from 'vitest' import UnitTestCase from '@/__tests__/UnitTestCase' -import { artistStore } from '@/stores' import factory from '@/__tests__/factory' import { httpService } from '@/services' +import { artistStore } from '.' new class extends UnitTestCase { protected beforeEach () { diff --git a/resources/assets/js/stores/commonStore.ts b/resources/assets/js/stores/commonStore.ts index 2f000d8560..8653212e8e 100644 --- a/resources/assets/js/stores/commonStore.ts +++ b/resources/assets/js/stores/commonStore.ts @@ -1,7 +1,7 @@ import isMobile from 'ismobilejs' import { reactive } from 'vue' import { httpService } from '@/services' -import { playlistFolderStore, playlistStore, preferenceStore, settingStore, themeStore, userStore } from '@/stores' +import { playlistFolderStore, playlistStore, preferenceStore, settingStore, themeStore, userStore } from '.' interface CommonStoreState { allow_download: boolean diff --git a/resources/assets/js/stores/favoriteStore.spec.ts b/resources/assets/js/stores/favoriteStore.spec.ts index 51963b2c59..821a512151 100644 --- a/resources/assets/js/stores/favoriteStore.spec.ts +++ b/resources/assets/js/stores/favoriteStore.spec.ts @@ -1,8 +1,8 @@ import { expect, it } from 'vitest' import factory from '@/__tests__/factory' import UnitTestCase from '@/__tests__/UnitTestCase' -import { favoriteStore } from '@/stores' import { httpService } from '@/services' +import { favoriteStore } from '.' new class extends UnitTestCase { protected beforeEach () { diff --git a/resources/assets/js/stores/overviewStore.spec.ts b/resources/assets/js/stores/overviewStore.spec.ts index 2e9c0dd37c..ff05016f09 100644 --- a/resources/assets/js/stores/overviewStore.spec.ts +++ b/resources/assets/js/stores/overviewStore.spec.ts @@ -2,7 +2,7 @@ import { expect, it } from 'vitest' import factory from '@/__tests__/factory' import UnitTestCase from '@/__tests__/UnitTestCase' import { httpService } from '@/services' -import { albumStore, artistStore, overviewStore, recentlyPlayedStore, songStore } from '@/stores' +import { albumStore, artistStore, overviewStore, recentlyPlayedStore, songStore } from '.' new class extends UnitTestCase { protected beforeEach () { diff --git a/resources/assets/js/stores/playlistStore.spec.ts b/resources/assets/js/stores/playlistStore.spec.ts index fa14658513..ca65919396 100644 --- a/resources/assets/js/stores/playlistStore.spec.ts +++ b/resources/assets/js/stores/playlistStore.spec.ts @@ -1,8 +1,8 @@ import UnitTestCase from '@/__tests__/UnitTestCase' import factory from '@/__tests__/factory' -import { playlistStore } from '@/stores' import { expect, it } from 'vitest' import { cache, httpService } from '@/services' +import { playlistStore } from '.' const ruleGroups: SmartPlaylistRuleGroup[] = [ { diff --git a/resources/assets/js/stores/preferenceStore.spec.ts b/resources/assets/js/stores/preferenceStore.spec.ts index d7ce547c5d..43f787d928 100644 --- a/resources/assets/js/stores/preferenceStore.spec.ts +++ b/resources/assets/js/stores/preferenceStore.spec.ts @@ -2,7 +2,7 @@ import { expect, it } from 'vitest' import factory from '@/__tests__/factory' import { localStorageService } from '@/services' import UnitTestCase from '@/__tests__/UnitTestCase' -import { preferenceStore } from '@/stores' +import { preferenceStore } from '.' new class extends UnitTestCase { protected beforeEach () { diff --git a/resources/assets/js/stores/queueStore.spec.ts b/resources/assets/js/stores/queueStore.spec.ts index 952f77be1f..9a94bc4693 100644 --- a/resources/assets/js/stores/queueStore.spec.ts +++ b/resources/assets/js/stores/queueStore.spec.ts @@ -1,10 +1,9 @@ +import { reactive } from 'vue' import UnitTestCase from '@/__tests__/UnitTestCase' -import { queueStore } from '@/stores/queueStore' import { expect, it } from 'vitest' import factory from 'factoria' import { httpService } from '@/services' -import { songStore } from '@/stores/songStore' -import { reactive } from 'vue' +import { queueStore, songStore } from '.' let songs @@ -63,7 +62,7 @@ new class extends UnitTestCase { expect(queueStore.state.songs).toHaveLength(0) }) - it.each([['Playing'], ['Paused']])('identifies the current song by %s state', (state: PlaybackState) => { + it.each<[PlaybackState]>([['Playing'], ['Paused']])('identifies the current song by %s state', state => { queueStore.state.songs[1].playback_state = state expect(queueStore.current).toEqual(queueStore.state.songs[1]) }) diff --git a/resources/assets/js/stores/recentlyPlayedStore.spec.ts b/resources/assets/js/stores/recentlyPlayedStore.spec.ts index 943365af87..c6d2a2d525 100644 --- a/resources/assets/js/stores/recentlyPlayedStore.spec.ts +++ b/resources/assets/js/stores/recentlyPlayedStore.spec.ts @@ -1,9 +1,8 @@ import { expect, it } from 'vitest' import factory from '@/__tests__/factory' import UnitTestCase from '@/__tests__/UnitTestCase' -import { songStore } from '@/stores/songStore' import { httpService } from '@/services' -import { recentlyPlayedStore } from '@/stores/recentlyPlayedStore' +import { recentlyPlayedStore, songStore } from '.' new class extends UnitTestCase { protected test () { diff --git a/resources/assets/js/stores/searchStore.spec.ts b/resources/assets/js/stores/searchStore.spec.ts index b7e8a03f4c..a905e725cc 100644 --- a/resources/assets/js/stores/searchStore.spec.ts +++ b/resources/assets/js/stores/searchStore.spec.ts @@ -3,10 +3,7 @@ import UnitTestCase from '@/__tests__/UnitTestCase' import { reactive } from 'vue' import factory from '@/__tests__/factory' import { httpService } from '@/services' -import { songStore } from '@/stores/songStore' -import { ExcerptSearchResult, searchStore } from '@/stores/searchStore' -import { albumStore } from '@/stores/albumStore' -import { artistStore } from '@/stores/artistStore' +import { albumStore, artistStore, ExcerptSearchResult, searchStore, songStore } from '.' new class extends UnitTestCase { protected beforeEach () { diff --git a/resources/assets/js/stores/settingStore.spec.ts b/resources/assets/js/stores/settingStore.spec.ts index d74f5c5bf3..b90cafb347 100644 --- a/resources/assets/js/stores/settingStore.spec.ts +++ b/resources/assets/js/stores/settingStore.spec.ts @@ -1,7 +1,7 @@ import { expect, it } from 'vitest' import UnitTestCase from '@/__tests__/UnitTestCase' -import { settingStore } from '@/stores/settingStore' import { httpService } from '@/services' +import { settingStore } from '.' new class extends UnitTestCase { protected test () { diff --git a/resources/assets/js/stores/songStore.spec.ts b/resources/assets/js/stores/songStore.spec.ts index 14494bcbca..d93cfee9dc 100644 --- a/resources/assets/js/stores/songStore.spec.ts +++ b/resources/assets/js/stores/songStore.spec.ts @@ -1,19 +1,11 @@ +import { reactive } from 'vue' import isMobile from 'ismobilejs' import UnitTestCase from '@/__tests__/UnitTestCase' import { expect, it } from 'vitest' import factory from '@/__tests__/factory' import { authService, httpService } from '@/services' -import { - albumStore, - artistStore, - commonStore, - overviewStore, - preferenceStore, - songStore, - SongUpdateResult -} from '@/stores' import { eventBus } from '@/utils' -import { reactive } from 'vue' +import { albumStore, artistStore, commonStore, overviewStore, preferenceStore, songStore, SongUpdateResult } from '.' new class extends UnitTestCase { protected afterEach () { diff --git a/resources/assets/js/stores/themeStore.spec.ts b/resources/assets/js/stores/themeStore.spec.ts index 86e314d00c..b8856f88a5 100644 --- a/resources/assets/js/stores/themeStore.spec.ts +++ b/resources/assets/js/stores/themeStore.spec.ts @@ -1,6 +1,6 @@ import { expect, it } from 'vitest' import UnitTestCase from '@/__tests__/UnitTestCase' -import { preferenceStore, themeStore } from '@/stores' +import { preferenceStore, themeStore } from '.' const testTheme: Theme = { id: 'test', diff --git a/resources/assets/js/stores/userStore.spec.ts b/resources/assets/js/stores/userStore.spec.ts index d98fbe5ee5..cffe119924 100644 --- a/resources/assets/js/stores/userStore.spec.ts +++ b/resources/assets/js/stores/userStore.spec.ts @@ -1,8 +1,8 @@ import { expect, it } from 'vitest' import UnitTestCase from '@/__tests__/UnitTestCase' -import { CreateUserData, UpdateCurrentProfileData, UpdateUserData, userStore } from '@/stores/userStore' import factory from '@/__tests__/factory' import { httpService } from '@/services' +import { CreateUserData, UpdateCurrentProfileData, UpdateUserData, userStore } from '.' const currentUser = factory('user', { id: 1,