forcedotcom / forcedotcom/git2gus

investigation: issue priority should be treated as string or integer consistently.

Open
#150 1 comment 1 reaction 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
28
Forks
14
PR merge metrics
No merged PRs in 30d

Description

This could be a bug, or it could be a test needing update. Reading `api/hooks/issues-hook/update-work-item-priority/index.js`, issue priority is treated numerically, and can be compared with higher-priority issues are `>` than lower-priority.

```js
const isNewPriorityGreat = issue && priority > issue.priority;
```

However, the test code for this passes in priority strings like "P1" and "P2". Strings like these compare the other way around, `"P2" > "P1"`, even though P1 should be higher-priority.

From `api/hooks/issues-hook/update-work-item-priority/__test__/updateWorkItemPriority.spec.js`,

```js
Issues.getByRelatedUrl.mockReturnValue(
Promise.resolve({
id: '1234abcd',
priority: 'P1'
})
);
```

Resolve this by looking at production logs or GUS api responses, and update either the test code or the implementation code. Consider adding type checking.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.