Fix frontend tests

This commit is contained in:
Georg Krause 2021-09-24 17:40:54 +02:00
parent 1a3cb02345
commit ad80ddfce4
No known key found for this signature in database
GPG Key ID: FD479B9A4D48E632
4 changed files with 12 additions and 7 deletions

View File

@ -183,10 +183,7 @@ export default {
axios.get('users/me/').then((response) => {
logger.default.info('Successfully fetched user profile')
dispatch('ui/initSettings', response.data.settings, { root: true })
dispatch('updateProfile', response.data).then(() => {
resolve(response.data)
})
dispatch('updateProfile', response.data)
dispatch('ui/fetchUnreadNotifications', null, { root: true })
if (response.data.permissions.library) {
dispatch('ui/fetchPendingReviewEdits', null, { root: true })
@ -200,6 +197,7 @@ export default {
dispatch('libraries/fetchFollows', null, { root: true })
dispatch('moderation/fetchContentFilters', null, { root: true })
dispatch('playlists/fetchOwn', null, { root: true })
resolve(response.data)
}, (response) => {
logger.default.info('Error while fetching user profile')
reject(new Error('Error while fetching user profile'))

View File

@ -159,7 +159,13 @@ describe('store/auth', () => {
{ type: 'permission', payload: {key: 'admin', status: true} }
],
expectedActions: [
{ type: 'ui/initSettings', payload: { root: true } },
{ type: 'updateProfile', payload: profile },
{ type: 'ui/fetchUnreadNotifications', payload: null },
{ type: 'favorites/fetch', payload: null, options: {root: true} },
{ type: 'channels/fetchSubscriptions', payload: null, options: {root: true} },
{ type: 'libraries/fetchFollows', payload: null, options: {root: true} },
{ type: 'moderation/fetchContentFilters', payload: null, options: {root: true} },
{ type: 'playlists/fetchOwn', payload: null, options: {root: true} }
]
})

View File

@ -274,7 +274,7 @@ describe('store/queue', () => {
it('shuffle', () => {
let _shuffle = sandbox.stub(_, 'shuffle')
let tracks = ['a', 'b', 'c', 'd', 'e']
let shuffledTracks = ['e', 'd', 'c']
let shuffledTracks = ['a', 'b', 'e', 'd', 'c']
_shuffle.returns(shuffledTracks)
testAction({
action: store.actions.shuffle,
@ -283,7 +283,8 @@ describe('store/queue', () => {
{ type: 'tracks', payload: [] }
],
expectedActions: [
{ type: 'appendMany', payload: {tracks: ['a', 'b'].concat(shuffledTracks)} }
{ type: 'appendMany', payload: {tracks: shuffledTracks} },
{ type: 'currentIndex', payload: {tracks: shuffledTracks} }
]
})
})

View File

@ -51,7 +51,7 @@ describe('store/radios', () => {
{ type: 'running', payload: true }
],
expectedActions: [
{ type: 'populateQueue' }
{ type: 'populateQueue', payload: true }
]
})
})