diff options
Diffstat (limited to 'spec/frontend/boards/board_list_helper.js')
-rw-r--r-- | spec/frontend/boards/board_list_helper.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/frontend/boards/board_list_helper.js b/spec/frontend/boards/board_list_helper.js index 811f0043a01..d0f14bd37c1 100644 --- a/spec/frontend/boards/board_list_helper.js +++ b/spec/frontend/boards/board_list_helper.js @@ -1,4 +1,5 @@ import { createLocalVue, shallowMount } from '@vue/test-utils'; +import VueApollo from 'vue-apollo'; import Vuex from 'vuex'; import BoardCard from '~/boards/components/board_card.vue'; @@ -6,7 +7,15 @@ import BoardList from '~/boards/components/board_list.vue'; import BoardNewIssue from '~/boards/components/board_new_issue.vue'; import BoardNewItem from '~/boards/components/board_new_item.vue'; import defaultState from '~/boards/stores/state'; -import { mockList, mockIssuesByListId, issues, mockGroupProjects } from './mock_data'; +import createMockApollo from 'helpers/mock_apollo_helper'; +import listQuery from 'ee_else_ce/boards/graphql/board_lists_deferred.query.graphql'; +import { + mockList, + mockIssuesByListId, + issues, + mockGroupProjects, + boardListQueryResponse, +} from './mock_data'; export default function createComponent({ listIssueProps = {}, @@ -15,16 +24,23 @@ export default function createComponent({ actions = {}, getters = {}, provide = {}, + data = {}, state = defaultState, stubs = { BoardNewIssue, BoardNewItem, BoardCard, }, + issuesCount, } = {}) { const localVue = createLocalVue(); + localVue.use(VueApollo); localVue.use(Vuex); + const fakeApollo = createMockApollo([ + [listQuery, jest.fn().mockResolvedValue(boardListQueryResponse(issuesCount))], + ]); + const store = new Vuex.Store({ state: { selectedProject: mockGroupProjects[0], @@ -68,6 +84,7 @@ export default function createComponent({ } const component = shallowMount(BoardList, { + apolloProvider: fakeApollo, localVue, store, propsData: { @@ -87,6 +104,11 @@ export default function createComponent({ ...provide, }, stubs, + data() { + return { + ...data, + }; + }, }); return component; |