summaryrefslogtreecommitdiff
path: root/spec/frontend/boards/boards_util_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/boards/boards_util_spec.js')
-rw-r--r--spec/frontend/boards/boards_util_spec.js30
1 files changed, 24 insertions, 6 deletions
diff --git a/spec/frontend/boards/boards_util_spec.js b/spec/frontend/boards/boards_util_spec.js
index d45b6e35a45..ab3cf072357 100644
--- a/spec/frontend/boards/boards_util_spec.js
+++ b/spec/frontend/boards/boards_util_spec.js
@@ -1,6 +1,12 @@
import { formatIssueInput, filterVariables } from '~/boards/boards_util';
describe('formatIssueInput', () => {
+ const issueInput = {
+ labelIds: ['gid://gitlab/GroupLabel/5'],
+ projectPath: 'gitlab-org/gitlab-test',
+ id: 'gid://gitlab/Issue/11',
+ };
+
it('correctly merges boardConfig into the issue', () => {
const boardConfig = {
labels: [
@@ -14,12 +20,6 @@ describe('formatIssueInput', () => {
weight: 1,
};
- const issueInput = {
- labelIds: ['gid://gitlab/GroupLabel/5'],
- projectPath: 'gitlab-org/gitlab-test',
- id: 'gid://gitlab/Issue/11',
- };
-
const result = formatIssueInput(issueInput, boardConfig);
expect(result).toEqual({
projectPath: 'gitlab-org/gitlab-test',
@@ -27,8 +27,26 @@ describe('formatIssueInput', () => {
labelIds: ['gid://gitlab/GroupLabel/5', 'gid://gitlab/GroupLabel/44'],
assigneeIds: ['gid://gitlab/User/55'],
milestoneId: 'gid://gitlab/Milestone/66',
+ weight: 1,
});
});
+
+ it('does not add weight to input if weight is NONE', () => {
+ const boardConfig = {
+ weight: -2, // NO_WEIGHT
+ };
+
+ const result = formatIssueInput(issueInput, boardConfig);
+ const expected = {
+ projectPath: 'gitlab-org/gitlab-test',
+ id: 'gid://gitlab/Issue/11',
+ labelIds: ['gid://gitlab/GroupLabel/5'],
+ assigneeIds: [],
+ milestoneId: undefined,
+ };
+
+ expect(result).toEqual(expected);
+ });
});
describe('filterVariables', () => {