Skip to content

Commit

Permalink
fix: update JQL to account for severity field in Story type
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Jan 2, 2025
1 parent a33dd54 commit 9243ff9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Jira {
severity: 'customfield_12316142',
};
readonly baseJQL =
'Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed';
'Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed';
JQL = '';

constructor(
Expand Down
14 changes: 7 additions & 7 deletions test/unit/jira.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('Jira functions', () => {
it('can be instantiated', () => {
expect(jira).toBeInstanceOf(Jira);
expect(jira.baseJQL).toMatchInlineSnapshot(
`"Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed"`
`"Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed"`
);
});

Expand Down Expand Up @@ -172,7 +172,7 @@ describe('Jira functions', () => {
undefined
);
expect(jira.JQL).toMatchInlineSnapshot(
`"Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed ORDER BY id DESC"`
`"Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed ORDER BY id DESC"`
);
expect(mocks.searchForIssuesUsingJqlPost).toHaveBeenCalledWith({
fields: [
Expand All @@ -185,7 +185,7 @@ describe('Jira functions', () => {
'customfield_12310243',
'priority',
],
jql: 'Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed ORDER BY id DESC',
jql: 'Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed ORDER BY id DESC',
});
expect(issues).toMatchInlineSnapshot(`
[
Expand Down Expand Up @@ -232,7 +232,7 @@ describe('Jira functions', () => {

issues = await jira.getIssues('component', undefined, undefined, undefined);
expect(jira.JQL).toMatchInlineSnapshot(
`"Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed AND component = component ORDER BY id DESC"`
`"Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed AND component = component ORDER BY id DESC"`
);

issues = await jira.getIssues(
Expand All @@ -242,7 +242,7 @@ describe('Jira functions', () => {
undefined
);
expect(jira.JQL).toMatchInlineSnapshot(
`"Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed AND component = component AND assignee = "assignee" ORDER BY id DESC"`
`"Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed AND component = component AND assignee = "assignee" ORDER BY id DESC"`
);

issues = await jira.getIssues(
Expand All @@ -252,12 +252,12 @@ describe('Jira functions', () => {
undefined
);
expect(jira.JQL).toMatchInlineSnapshot(
`"Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed AND component = component AND assignee = "assignee" AND developer = "developer" ORDER BY id DESC"`
`"Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed AND component = component AND assignee = "assignee" AND developer = "developer" ORDER BY id DESC"`
);

issues = await jira.getIssues(undefined, undefined, undefined, 'customJQL');
expect(jira.JQL).toMatchInlineSnapshot(
`"Project = RHEL AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY) AND status != Closed AND customJQL ORDER BY id DESC"`
`"Project = RHEL AND (type = Story AND ("Story Points" is EMPTY OR priority is EMPTY) OR type != Story AND ("Story Points" is EMPTY OR priority is EMPTY OR Severity is EMPTY)) AND status != Closed AND customJQL ORDER BY id DESC"`
);
});

Expand Down

0 comments on commit 9243ff9

Please sign in to comment.