mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2024-12-03 19:50:52 +00:00
test(store): address feedback
This commit is contained in:
parent
34d8dc4396
commit
48b4da206c
@ -53,7 +53,7 @@ describe('vuex: backdrop', () => {
|
||||
|
||||
store.commit('CLEAR_CURRENT_BACKDROP');
|
||||
|
||||
expect(store.state.blurhash).toBe('');
|
||||
expect(store.state.blurhash).toBe(defaultState().blurhash);
|
||||
});
|
||||
|
||||
it('resets the opacity when "RESET_BACKDROP_OPACITY" is committed', () => {
|
||||
@ -61,7 +61,7 @@ describe('vuex: backdrop', () => {
|
||||
|
||||
store.commit('RESET_BACKDROP_OPACITY');
|
||||
|
||||
expect(store.state.opacity).toBe(0.75);
|
||||
expect(store.state.opacity).toBe(defaultState().opacity);
|
||||
});
|
||||
|
||||
// Default case
|
||||
@ -81,7 +81,7 @@ describe('vuex: backdrop', () => {
|
||||
|
||||
store.dispatch('clearBackdrop');
|
||||
|
||||
expect(store.state.blurhash).toBe('');
|
||||
expect(store.state.blurhash).toBe(defaultState().blurhash);
|
||||
});
|
||||
|
||||
it('sets the opacity when setBackdropOpacity is dispatched', () => {
|
||||
|
@ -234,7 +234,7 @@ describe('vuex: playbackManager', () => {
|
||||
|
||||
store.commit('CLEAR_QUEUE');
|
||||
|
||||
expect(store.state.queue).toMatchObject([]);
|
||||
expect(store.state.queue).toMatchObject(defaultState().queue);
|
||||
});
|
||||
|
||||
it('sets the current and last indexes when "SET_CURRENT_ITEM_INDEX" is committed', () => {
|
||||
@ -453,6 +453,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the playback status to stopped when stop is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
status: PlaybackStatus.playing
|
||||
@ -464,6 +465,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the playback status to paused when pause is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
status: PlaybackStatus.playing
|
||||
@ -475,6 +477,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the playback status to playing when unpause is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
status: PlaybackStatus.paused
|
||||
@ -486,6 +489,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('toggles the playback status when playPause is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
status: PlaybackStatus.paused
|
||||
@ -501,6 +505,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('clears the queue when clearQueue is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
queue: [DEMO_TEST_ITEM_A, DEMO_TEST_ITEM_B]
|
||||
@ -508,10 +513,11 @@ describe('vuex: playbackManager', () => {
|
||||
|
||||
store.dispatch('clearQueue');
|
||||
|
||||
expect(store.state.queue).toMatchObject([]);
|
||||
expect(store.state.queue).toMatchObject(defaultState().queue);
|
||||
});
|
||||
|
||||
it('sets the media source when setMediaSource is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -524,6 +530,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('clears the queue when setNextTrack is dispatched at the end of the queue', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
queue: [DEMO_TEST_ITEM_A, DEMO_TEST_ITEM_B],
|
||||
@ -537,6 +544,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('increases the item indexes when setNextTrack is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
queue: [DEMO_TEST_ITEM_A, DEMO_TEST_ITEM_B],
|
||||
@ -550,6 +558,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('clears the current time when setPreviousTrack is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentTime: 5
|
||||
@ -561,6 +570,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('decreases the item indexs when setPreviousTrack is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentItemIndex: 3
|
||||
@ -573,6 +583,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('clears the current time when resetCurrentTime is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentTime: 1.234
|
||||
@ -584,6 +595,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('clears the current item index when resetCurrentItemIndex is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentItemIndex: 1
|
||||
@ -595,6 +607,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the last item index to the current item index when setLastItemIndex is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
lastItemIndex: 1,
|
||||
@ -607,6 +620,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('clears the last item index when resetLastItemIndex is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
lastItemIndex: 1
|
||||
@ -618,6 +632,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the last progress update when setLastProgressUpdate is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -628,6 +643,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the current volume when setVolume is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -638,6 +654,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the current item index when setCurrentIndex is dispatched with the same index', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentItemIndex: 5
|
||||
@ -649,6 +666,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the current item index when setCurrentIndex is dispatched with a new index', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentItemIndex: 5
|
||||
@ -660,6 +678,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the current time when when setCurrentTime is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -670,6 +689,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the current time when when changeCurrentTime is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -680,6 +700,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('updates the current time when skipForward is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentTime: 10
|
||||
@ -691,6 +712,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('resets the current time when skipBackward is dispatched when at 10 seconds or less', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentTime: 10
|
||||
@ -702,6 +724,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the current time when skipBackward is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
currentTime: 25
|
||||
@ -713,6 +736,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('updates the minimized flag when setMinimized is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
isMinimized: false
|
||||
@ -724,6 +748,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('updates the minimized flag when toggleMinimized is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
isMinimized: false
|
||||
@ -739,6 +764,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the play session ID when setPlaySessionId is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -749,6 +775,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('sets the repeat mode when setRepeatMode is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -759,6 +786,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('toggles between RepeatAll, RepeatOne and RepeatNone when toggleRepeatMode is dispatched with multiple items in the queue', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
queue: [DEMO_TEST_ITEM_A, DEMO_TEST_ITEM_B],
|
||||
@ -779,6 +807,7 @@ describe('vuex: playbackManager', () => {
|
||||
});
|
||||
|
||||
it('toggles between RepeatOne and RepeatNone when toggleRepeatMode is dispatched with one item in the queue', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
queue: [DEMO_TEST_ITEM_A],
|
||||
|
@ -77,6 +77,7 @@ describe('vuex: servers', () => {
|
||||
});
|
||||
|
||||
it('adds a server to the server list when addServer is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState()
|
||||
});
|
||||
@ -89,6 +90,7 @@ describe('vuex: servers', () => {
|
||||
});
|
||||
|
||||
it('removes a server from the server list when removeServer is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
...defaultState(),
|
||||
serverList: [DEMO_TEST_SERVER_VALUE]
|
||||
@ -100,6 +102,7 @@ describe('vuex: servers', () => {
|
||||
});
|
||||
|
||||
it('clears the store when clearServers is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
serverUsed: DEMO_TEST_SERVER_VALUE,
|
||||
serverList: [DEMO_TEST_SERVER_VALUE]
|
||||
|
@ -26,7 +26,7 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe('vuex: snackbar', () => {
|
||||
it('sets the snackbard message when "SET_SNACKBAR_MESSAGE" is committed', () => {
|
||||
it('sets the snackbar message when "SET_SNACKBAR_MESSAGE" is committed', () => {
|
||||
store.replaceState({ ...defaultState() });
|
||||
|
||||
store.commit('SET_SNACKBAR_MESSAGE', SNACKBAR_SET_TEST_VALUE);
|
||||
@ -34,7 +34,7 @@ describe('vuex: snackbar', () => {
|
||||
expect(store.state).toMatchObject(SNACKBAR_SET_TEST_VALUE);
|
||||
});
|
||||
|
||||
it('resets the snackbard message when "RESET_MESSAGE" is committed', () => {
|
||||
it('resets the snackbar message when "RESET_MESSAGE" is committed', () => {
|
||||
store.replaceState({ ...SNACKBAR_SET_TEST_VALUE });
|
||||
|
||||
store.commit('RESET_MESSAGE');
|
||||
@ -43,6 +43,7 @@ describe('vuex: snackbar', () => {
|
||||
});
|
||||
|
||||
it('sets the snackbar message and color when pushSnackbarMessage is dispatched with a color', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({ ...defaultState() });
|
||||
|
||||
store.dispatch('pushSnackbarMessage', SNACKBAR_SET_TEST_VALUE);
|
||||
@ -51,7 +52,8 @@ describe('vuex: snackbar', () => {
|
||||
});
|
||||
|
||||
// Undefined color is '' when color is not passed
|
||||
it('sets the snackback message and no color when pushSnackbarMessage is dispatched without a color', () => {
|
||||
it('sets the snackbar message and no color when pushSnackbarMessage is dispatched without a color', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({ ...defaultState() });
|
||||
|
||||
store.dispatch('pushSnackbarMessage', {
|
||||
@ -66,6 +68,7 @@ describe('vuex: snackbar', () => {
|
||||
});
|
||||
|
||||
it('clears the snackbar message when resetMessage is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({ ...SNACKBAR_SET_TEST_VALUE });
|
||||
|
||||
store.dispatch('resetMessage');
|
||||
|
@ -90,7 +90,8 @@ describe('vuex: tvShows', () => {
|
||||
expect(store.state).toMatchObject(defaultState());
|
||||
});
|
||||
|
||||
it('sets the show, seasons and episodes <hen getTvShowsSeasonEpisodesSuccess is dispatched', () => {
|
||||
it('sets the show, seasons and episodes when getTvShowsSeasonEpisodesSuccess is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({ ...defaultState() });
|
||||
|
||||
store.dispatch('getTvShowsSeasonEpisodesSuccess', {
|
||||
@ -107,6 +108,7 @@ describe('vuex: tvShows', () => {
|
||||
});
|
||||
|
||||
it('clears the store when clearTvShows is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
[TEST_TV_SERIES.Id || '']: {
|
||||
seasons: [TEST_TV_SEASON_1, TEST_TV_SEASON_2],
|
||||
|
@ -62,17 +62,18 @@ describe('vuex: userViews', () => {
|
||||
|
||||
store.commit('CLEAR_USER_VIEWS');
|
||||
|
||||
expect(store.state.views).toMatchObject([]);
|
||||
expect(store.state.views).toMatchObject(defaultState().views);
|
||||
});
|
||||
|
||||
it('clears the user views when clearUserViews is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
views: [DEMO_TEST_ITEM_A, DEMO_TEST_ITEM_B, DEMO_TEST_ITEM_C]
|
||||
});
|
||||
|
||||
store.dispatch('clearUserViews');
|
||||
|
||||
expect(store.state.views).toMatchObject([]);
|
||||
expect(store.state.views).toMatchObject(defaultState().views);
|
||||
});
|
||||
|
||||
it('gets the navigation drawer items when getNavigationDrawerItems is called', () => {
|
||||
@ -87,7 +88,8 @@ describe('vuex: userViews', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('gets all the user views when getUserViews is callsed dispatched', () => {
|
||||
it('gets all the user views when getUserViews is dispatched', () => {
|
||||
// TODO: This should only test if the proper mutation is committed
|
||||
store.replaceState({
|
||||
views: [DEMO_TEST_ITEM_A, DEMO_TEST_ITEM_B, DEMO_TEST_ITEM_C]
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user