Skip to content

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

@mpsenn

Description

@mpsenn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions