Commit 7222369f authored by Florie Guibert's avatar Florie Guibert

Fix create issue in board with scope weight NONE

Fixed in same milestone
parent d234a872
......@@ -121,7 +121,7 @@ export function formatIssueInput(issueInput, boardConfig) {
: issueInput?.milestoneId,
labelIds: [...labelIds, ...(labels?.map((l) => fullLabelId(l)) || [])],
assigneeIds: [...assigneeIds, ...(assigneeId ? [fullUserId(assigneeId)] : [])],
weight,
weight: weight > -1 ? weight : undefined,
};
}
......
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',
......@@ -30,6 +30,23 @@ describe('formatIssueInput', () => {
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', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment