Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-19 15:09:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-19 15:09:20 +0300
commit6559f0ee67c564d62e12936e91cef6abf37ce102 (patch)
treeac843e2187f4fa22eade9be5ae380a7fc793e31b /spec/frontend/boards/stores/actions_spec.js
parent93e4425400aa60f54f1bbccb26ef6581503952f3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/stores/actions_spec.js')
-rw-r--r--spec/frontend/boards/stores/actions_spec.js76
1 files changed, 75 insertions, 1 deletions
diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js
index fb882aaa8d6..78e70161121 100644
--- a/spec/frontend/boards/stores/actions_spec.js
+++ b/spec/frontend/boards/stores/actions_spec.js
@@ -13,7 +13,7 @@ import actions, { gqlClient } from '~/boards/stores/actions';
import * as types from '~/boards/stores/mutation_types';
import { inactiveId, ListType } from '~/boards/constants';
import issueMoveListMutation from '~/boards/queries/issue_move_list.mutation.graphql';
-import { fullBoardId, formatListIssues } from '~/boards/boards_util';
+import { fullBoardId, formatListIssues, formatBoardLists } from '~/boards/boards_util';
const expectNotImplemented = action => {
it('is not implemented', () => {
@@ -78,6 +78,80 @@ describe('setActiveId', () => {
});
});
+describe('fetchLists', () => {
+ const state = {
+ endpoints: {
+ fullPath: 'gitlab-org',
+ boardId: 1,
+ },
+ filterParams: {},
+ boardType: 'group',
+ };
+
+ let queryResponse = {
+ data: {
+ group: {
+ board: {
+ hideBacklogList: true,
+ lists: {
+ nodes: [mockLists[1]],
+ },
+ },
+ },
+ },
+ };
+
+ const formattedLists = formatBoardLists(queryResponse.data.group.board.lists);
+
+ it('should commit mutations RECEIVE_BOARD_LISTS_SUCCESS on success', done => {
+ jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
+
+ testAction(
+ actions.fetchLists,
+ {},
+ state,
+ [
+ {
+ type: types.RECEIVE_BOARD_LISTS_SUCCESS,
+ payload: formattedLists,
+ },
+ ],
+ [{ type: 'showWelcomeList' }],
+ done,
+ );
+ });
+
+ it('dispatch createList action when backlog list does not exist and is not hidden', done => {
+ queryResponse = {
+ data: {
+ group: {
+ board: {
+ hideBacklogList: false,
+ lists: {
+ nodes: [mockLists[1]],
+ },
+ },
+ },
+ },
+ };
+ jest.spyOn(gqlClient, 'query').mockResolvedValue(queryResponse);
+
+ testAction(
+ actions.fetchLists,
+ {},
+ state,
+ [
+ {
+ type: types.RECEIVE_BOARD_LISTS_SUCCESS,
+ payload: formattedLists,
+ },
+ ],
+ [{ type: 'createList', payload: { backlog: true } }, { type: 'showWelcomeList' }],
+ done,
+ );
+ });
+});
+
describe('showWelcomeList', () => {
it('should dispatch addList action', done => {
const state = {