forcedotcom / git2gus

A Github application to keep issues in sync with Agile Accelerator
https://lwc-gus-bot.herokuapp.com
BSD 3-Clause "New" or "Revised" License
27 stars 16 forks source link

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

Open mpsenn opened 1 year ago

mpsenn commented 1 year ago

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.

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,

        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.

git2gus[bot] commented 1 year ago

Git2Gus App is installed but the .git2gus/config.json doesn't exist.