diff options
Diffstat (limited to 'spec/frontend/user_lists')
11 files changed, 31 insertions, 40 deletions
diff --git a/spec/frontend/user_lists/components/edit_user_list_spec.js b/spec/frontend/user_lists/components/edit_user_list_spec.js index 7cafe5e1f56..941c8244247 100644 --- a/spec/frontend/user_lists/components/edit_user_list_spec.js +++ b/spec/frontend/user_lists/components/edit_user_list_spec.js @@ -8,7 +8,7 @@ import { redirectTo } from '~/lib/utils/url_utility'; import EditUserList from '~/user_lists/components/edit_user_list.vue'; import UserListForm from '~/user_lists/components/user_list_form.vue'; import createStore from '~/user_lists/store/edit'; -import { userList } from '../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('~/api'); jest.mock('~/lib/utils/url_utility'); diff --git a/spec/frontend/user_lists/components/new_user_list_spec.js b/spec/frontend/user_lists/components/new_user_list_spec.js index 5eb44970fe4..ace4a284347 100644 --- a/spec/frontend/user_lists/components/new_user_list_spec.js +++ b/spec/frontend/user_lists/components/new_user_list_spec.js @@ -7,7 +7,7 @@ import Api from '~/api'; import { redirectTo } from '~/lib/utils/url_utility'; import NewUserList from '~/user_lists/components/new_user_list.vue'; import createStore from '~/user_lists/store/new'; -import { userList } from '../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('~/api'); jest.mock('~/lib/utils/url_utility'); diff --git a/spec/frontend/user_lists/components/user_list_form_spec.js b/spec/frontend/user_lists/components/user_list_form_spec.js index 42f7659600e..e09d8eac32f 100644 --- a/spec/frontend/user_lists/components/user_list_form_spec.js +++ b/spec/frontend/user_lists/components/user_list_form_spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import Form from '~/user_lists/components/user_list_form.vue'; -import { userList } from '../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; describe('user_lists/components/user_list_form', () => { let wrapper; diff --git a/spec/frontend/user_lists/components/user_list_spec.js b/spec/frontend/user_lists/components/user_list_spec.js index 88dad06938b..f126c733dd5 100644 --- a/spec/frontend/user_lists/components/user_list_spec.js +++ b/spec/frontend/user_lists/components/user_list_spec.js @@ -7,7 +7,7 @@ import Api from '~/api'; import UserList from '~/user_lists/components/user_list.vue'; import createStore from '~/user_lists/store/show'; import { parseUserIds, stringifyUserIds } from '~/user_lists/store/utils'; -import { userList } from '../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('~/api'); diff --git a/spec/frontend/user_lists/components/user_lists_spec.js b/spec/frontend/user_lists/components/user_lists_spec.js index 10742c029c1..161eb036361 100644 --- a/spec/frontend/user_lists/components/user_lists_spec.js +++ b/spec/frontend/user_lists/components/user_lists_spec.js @@ -9,7 +9,7 @@ import UserListsComponent from '~/user_lists/components/user_lists.vue'; import UserListsTable from '~/user_lists/components/user_lists_table.vue'; import createStore from '~/user_lists/store/index'; import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue'; -import { userList } from '../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('~/api'); diff --git a/spec/frontend/user_lists/components/user_lists_table_spec.js b/spec/frontend/user_lists/components/user_lists_table_spec.js index 63587703392..08eb8ae0843 100644 --- a/spec/frontend/user_lists/components/user_lists_table_spec.js +++ b/spec/frontend/user_lists/components/user_lists_table_spec.js @@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils'; import * as timeago from 'timeago.js'; import { nextTick } from 'vue'; import UserListsTable from '~/user_lists/components/user_lists_table.vue'; -import { userList } from '../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('timeago.js', () => ({ format: jest.fn().mockReturnValue('2 weeks ago'), diff --git a/spec/frontend/user_lists/store/edit/actions_spec.js b/spec/frontend/user_lists/store/edit/actions_spec.js index c4b0f888d3e..ca56c935ea5 100644 --- a/spec/frontend/user_lists/store/edit/actions_spec.js +++ b/spec/frontend/user_lists/store/edit/actions_spec.js @@ -4,7 +4,7 @@ import { redirectTo } from '~/lib/utils/url_utility'; import * as actions from '~/user_lists/store/edit/actions'; import * as types from '~/user_lists/store/edit/mutation_types'; import createState from '~/user_lists/store/edit/state'; -import { userList } from '../../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('~/api'); jest.mock('~/lib/utils/url_utility'); diff --git a/spec/frontend/user_lists/store/edit/mutations_spec.js b/spec/frontend/user_lists/store/edit/mutations_spec.js index 0943c64e934..7971906429b 100644 --- a/spec/frontend/user_lists/store/edit/mutations_spec.js +++ b/spec/frontend/user_lists/store/edit/mutations_spec.js @@ -2,7 +2,7 @@ import statuses from '~/user_lists/constants/edit'; import * as types from '~/user_lists/store/edit/mutation_types'; import mutations from '~/user_lists/store/edit/mutations'; import createState from '~/user_lists/store/edit/state'; -import { userList } from '../../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; describe('User List Edit Mutations', () => { let state; diff --git a/spec/frontend/user_lists/store/index/actions_spec.js b/spec/frontend/user_lists/store/index/actions_spec.js index c5d7d557de9..4a8d0afb963 100644 --- a/spec/frontend/user_lists/store/index/actions_spec.js +++ b/spec/frontend/user_lists/store/index/actions_spec.js @@ -12,7 +12,7 @@ import { } from '~/user_lists/store/index/actions'; import * as types from '~/user_lists/store/index/mutation_types'; import createState from '~/user_lists/store/index/state'; -import { userList } from '../../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('~/api.js'); @@ -24,14 +24,13 @@ describe('~/user_lists/store/index/actions', () => { }); describe('setUserListsOptions', () => { - it('should commit SET_USER_LISTS_OPTIONS mutation', (done) => { - testAction( + it('should commit SET_USER_LISTS_OPTIONS mutation', () => { + return testAction( setUserListsOptions, { page: '1', scope: 'all' }, state, [{ type: types.SET_USER_LISTS_OPTIONS, payload: { page: '1', scope: 'all' } }], [], - done, ); }); }); @@ -42,8 +41,8 @@ describe('~/user_lists/store/index/actions', () => { }); describe('success', () => { - it('dispatches requestUserLists and receiveUserListsSuccess ', (done) => { - testAction( + it('dispatches requestUserLists and receiveUserListsSuccess ', () => { + return testAction( fetchUserLists, null, state, @@ -57,16 +56,15 @@ describe('~/user_lists/store/index/actions', () => { type: 'receiveUserListsSuccess', }, ], - done, ); }); }); describe('error', () => { - it('dispatches requestUserLists and receiveUserListsError ', (done) => { + it('dispatches requestUserLists and receiveUserListsError ', () => { Api.fetchFeatureFlagUserLists.mockRejectedValue(); - testAction( + return testAction( fetchUserLists, null, state, @@ -79,21 +77,20 @@ describe('~/user_lists/store/index/actions', () => { type: 'receiveUserListsError', }, ], - done, ); }); }); }); describe('requestUserLists', () => { - it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => { - testAction(requestUserLists, null, state, [{ type: types.REQUEST_USER_LISTS }], [], done); + it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', () => { + return testAction(requestUserLists, null, state, [{ type: types.REQUEST_USER_LISTS }], []); }); }); describe('receiveUserListsSuccess', () => { - it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', (done) => { - testAction( + it('should commit RECEIVE_USER_LISTS_SUCCESS mutation', () => { + return testAction( receiveUserListsSuccess, { data: [userList], headers: {} }, state, @@ -104,20 +101,18 @@ describe('~/user_lists/store/index/actions', () => { }, ], [], - done, ); }); }); describe('receiveUserListsError', () => { - it('should commit RECEIVE_USER_LISTS_ERROR mutation', (done) => { - testAction( + it('should commit RECEIVE_USER_LISTS_ERROR mutation', () => { + return testAction( receiveUserListsError, null, state, [{ type: types.RECEIVE_USER_LISTS_ERROR }], [], - done, ); }); }); @@ -132,14 +127,13 @@ describe('~/user_lists/store/index/actions', () => { Api.deleteFeatureFlagUserList.mockResolvedValue(); }); - it('should refresh the user lists', (done) => { - testAction( + it('should refresh the user lists', () => { + return testAction( deleteUserList, userList, state, [], [{ type: 'requestDeleteUserList', payload: userList }, { type: 'fetchUserLists' }], - done, ); }); }); @@ -149,8 +143,8 @@ describe('~/user_lists/store/index/actions', () => { Api.deleteFeatureFlagUserList.mockRejectedValue({ response: { data: 'some error' } }); }); - it('should dispatch receiveDeleteUserListError', (done) => { - testAction( + it('should dispatch receiveDeleteUserListError', () => { + return testAction( deleteUserList, userList, state, @@ -162,15 +156,14 @@ describe('~/user_lists/store/index/actions', () => { payload: { list: userList, error: 'some error' }, }, ], - done, ); }); }); }); describe('receiveDeleteUserListError', () => { - it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', (done) => { - testAction( + it('should commit RECEIVE_DELETE_USER_LIST_ERROR with the given list', () => { + return testAction( receiveDeleteUserListError, { list: userList, error: 'mock error' }, state, @@ -181,22 +174,20 @@ describe('~/user_lists/store/index/actions', () => { }, ], [], - done, ); }); }); describe('clearAlert', () => { - it('should commit RECEIVE_CLEAR_ALERT', (done) => { + it('should commit RECEIVE_CLEAR_ALERT', () => { const alertIndex = 3; - testAction( + return testAction( clearAlert, alertIndex, state, [{ type: 'RECEIVE_CLEAR_ALERT', payload: alertIndex }], [], - done, ); }); }); diff --git a/spec/frontend/user_lists/store/index/mutations_spec.js b/spec/frontend/user_lists/store/index/mutations_spec.js index 370838ae5fb..18d6a9b8f38 100644 --- a/spec/frontend/user_lists/store/index/mutations_spec.js +++ b/spec/frontend/user_lists/store/index/mutations_spec.js @@ -2,7 +2,7 @@ import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils'; import * as types from '~/user_lists/store/index/mutation_types'; import mutations from '~/user_lists/store/index/mutations'; import createState from '~/user_lists/store/index/state'; -import { userList } from '../../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; describe('~/user_lists/store/index/mutations', () => { let state; diff --git a/spec/frontend/user_lists/store/new/actions_spec.js b/spec/frontend/user_lists/store/new/actions_spec.js index 916ec2e6da7..fa69fa7fa66 100644 --- a/spec/frontend/user_lists/store/new/actions_spec.js +++ b/spec/frontend/user_lists/store/new/actions_spec.js @@ -4,7 +4,7 @@ import { redirectTo } from '~/lib/utils/url_utility'; import * as actions from '~/user_lists/store/new/actions'; import * as types from '~/user_lists/store/new/mutation_types'; import createState from '~/user_lists/store/new/state'; -import { userList } from '../../../feature_flags/mock_data'; +import { userList } from 'jest/feature_flags/mock_data'; jest.mock('~/api'); jest.mock('~/lib/utils/url_utility'); |