From 7bd8f9822b05eb2e8c8279678e38e7513c3612f6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 14 Jan 2022 09:14:36 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/frontend/boards/stores/actions_spec.js | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'spec/frontend/boards/stores/actions_spec.js') diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index 51340a3ea4f..7c842d71688 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -29,6 +29,8 @@ import * as types from '~/boards/stores/mutation_types'; import mutations from '~/boards/stores/mutations'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; +import projectBoardMilestones from '~/boards/graphql/project_board_milestones.query.graphql'; +import groupBoardMilestones from '~/boards/graphql/group_board_milestones.query.graphql'; import { mockLists, mockListsById, @@ -308,6 +310,36 @@ describe('fetchMilestones', () => { expect(() => actions.fetchMilestones(store)).toThrow(new Error('Unknown board type')); }); + it.each([ + [ + 'project', + { + query: projectBoardMilestones, + variables: { fullPath: 'gitlab-org/gitlab', state: 'active' }, + }, + ], + [ + 'group', + { + query: groupBoardMilestones, + variables: { fullPath: 'gitlab-org/gitlab', state: 'active' }, + }, + ], + ])( + 'when boardType is %s it calls fetchMilestones with the correct query and variables', + (boardType, variables) => { + jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); + + const store = createStore(); + + store.state.boardType = boardType; + + actions.fetchMilestones(store); + + expect(gqlClient.query).toHaveBeenCalledWith(variables); + }, + ); + it('sets milestonesLoading to true', async () => { jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse); -- cgit v1.2.3