-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create comment-issue-due-date helper #443
Conversation
fb39c1f
to
1f18f04
Compare
|
||
jobs: | ||
test: | ||
if: contains(fromJSON('["Priority: Critical", "Priority: High", "Priority: Medium", "Priority: Low"]'), github.event.label.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be more intuitive to run this helper for each label and have it do nothing in the case the label doesn't match
import { PRIORITY_1, PRIORITY_2, PRIORITY_3, PRIORITY_4 } from '../constants'; | ||
|
||
export class CreateIssueDuedateComment extends HelperInputs { | ||
label!: typeof PRIORITY_1 | typeof PRIORITY_2 | typeof PRIORITY_3 | typeof PRIORITY_4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label!: typeof PRIORITY_1 | typeof PRIORITY_2 | typeof PRIORITY_3 | typeof PRIORITY_4; | |
label!: keyof typeof daysOpenBasedOnPriority |
export type PriorityDueDateMapping = { | ||
[key: string]: number; | ||
}; | ||
|
||
const daysOpenBasedOnPriority: PriorityDueDateMapping = { | ||
[PRIORITY_1]: 2, | ||
[PRIORITY_2]: 14, | ||
[PRIORITY_3]: 45, | ||
[PRIORITY_4]: 90 | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type PriorityDueDateMapping = { | |
[key: string]: number; | |
}; | |
const daysOpenBasedOnPriority: PriorityDueDateMapping = { | |
[PRIORITY_1]: 2, | |
[PRIORITY_2]: 14, | |
[PRIORITY_3]: 45, | |
[PRIORITY_4]: 90 | |
}; | |
const daysOpenBasedOnPriority = { | |
[PRIORITY_1]: 2, | |
[PRIORITY_2]: 14, | |
[PRIORITY_3]: 45, | |
[PRIORITY_4]: 90 | |
} as const; |
jest.spyOn(Date, 'now').mockImplementation(() => new Date('2023-09-26T10:00:00Z').getTime()); | ||
|
||
describe('commentIssueDueDate', () => { | ||
it('should add due dates correctly based on priority label', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a test for if an invalid label is added
📝 Description
This issue is due on Mon Dec 25 2023
). The due date is based on SLA guidelines (see table).