fix: broken tests in Node 14

This commit is contained in:
Phan An 2022-12-03 16:55:22 +01:00
parent f021d41e9d
commit 784374382a
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC
2 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ let artist: Artist
new class extends UnitTestCase { new class extends UnitTestCase {
private async renderComponent (mode: MediaInfoDisplayMode = 'aside', info?: ArtistInfo) { private async renderComponent (mode: MediaInfoDisplayMode = 'aside', info?: ArtistInfo) {
commonStore.state.use_last_fm = true commonStore.state.use_last_fm = true
info ??= factory<ArtistInfo>('artist-info') info = info ?? factory<ArtistInfo>('artist-info')
artist = factory<Artist>('artist', { name: 'Led Zeppelin' }) artist = factory<Artist>('artist', { name: 'Led Zeppelin' })
const fetchMock = this.mock(mediaInfoService, 'fetchForArtist').mockResolvedValue(info) const fetchMock = this.mock(mediaInfoService, 'fetchForArtist').mockResolvedValue(info)

View file

@ -11,12 +11,12 @@ let playlist: Playlist
new class extends UnitTestCase { new class extends UnitTestCase {
private async renderComponent (songs: Song[]) { private async renderComponent (songs: Song[]) {
playlist ||= factory<Playlist>('playlist') playlist = playlist || factory<Playlist>('playlist')
playlistStore.init([playlist]) playlistStore.init([playlist])
const fetchMock = this.mock(songStore, 'fetchForPlaylist').mockResolvedValue(songs) const fetchMock = this.mock(songStore, 'fetchForPlaylist').mockResolvedValue(songs)
const rendered = this.render(PlaylistScreen) this.render(PlaylistScreen)
await this.router.activateRoute({ await this.router.activateRoute({
path: `playlists/${playlist.id}`, path: `playlists/${playlist.id}`,