* feat(exempt): add new options to exempt the milestones closes #270 * test(milestones): add coverage * test(issue): add coverage * chore(rebase): fix all errors due to the rebase also made some changes regarding the change I made with the lint scripts and prettier. I did not saw that some scripts were already here and I created to more to keep the old ones as well * test(milestone): add coverage * chore(index): update index * fix(checks): remove checks over optional number options the code was actually handling the case where the values are NaN so it's fine
58 lines
1.2 KiB
TypeScript
58 lines
1.2 KiB
TypeScript
import {Issue} from '../classes/issue';
|
|
import {isPullRequest} from './is-pull-request';
|
|
|
|
describe('isPullRequest()', (): void => {
|
|
let issue: Issue;
|
|
|
|
describe('when the given issue has an undefined pull request', (): void => {
|
|
beforeEach((): void => {
|
|
issue = {
|
|
pull_request: undefined
|
|
} as Issue;
|
|
});
|
|
|
|
it('should return false', (): void => {
|
|
expect.assertions(1);
|
|
|
|
const result = isPullRequest(issue);
|
|
|
|
expect(result).toStrictEqual(false);
|
|
});
|
|
});
|
|
|
|
describe('when the given issue has a null pull request', (): void => {
|
|
beforeEach((): void => {
|
|
issue = {
|
|
pull_request: null
|
|
} as Issue;
|
|
});
|
|
|
|
it('should return false', (): void => {
|
|
expect.assertions(1);
|
|
|
|
const result = isPullRequest(issue);
|
|
|
|
expect(result).toStrictEqual(false);
|
|
});
|
|
});
|
|
|
|
describe.each([{}, true])(
|
|
'when the given issue has pull request',
|
|
(value): void => {
|
|
beforeEach((): void => {
|
|
issue = {
|
|
pull_request: value
|
|
} as Issue;
|
|
});
|
|
|
|
it('should return true', (): void => {
|
|
expect.assertions(1);
|
|
|
|
const result = isPullRequest(issue);
|
|
|
|
expect(result).toStrictEqual(true);
|
|
});
|
|
}
|
|
);
|
|
});
|