2021-03-02 04:34:35 +08:00
|
|
|
import {Issue} from '../../src/classes/issue';
|
|
|
|
import {IssuesProcessor} from '../../src/classes/issues-processor';
|
|
|
|
import {IComment} from '../../src/interfaces/comment';
|
|
|
|
import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options';
|
2021-09-20 21:37:32 +08:00
|
|
|
import {IPullRequest} from '../../src/interfaces/pull-request';
|
2021-03-02 04:34:35 +08:00
|
|
|
|
|
|
|
export class IssuesProcessorMock extends IssuesProcessor {
|
|
|
|
constructor(
|
|
|
|
options: IIssuesProcessorOptions,
|
|
|
|
getIssues?: (page: number) => Promise<Issue[]>,
|
|
|
|
listIssueComments?: (
|
2022-02-04 22:54:35 +08:00
|
|
|
issue: Issue,
|
2021-03-02 04:34:35 +08:00
|
|
|
sinceDate: string
|
|
|
|
) => Promise<IComment[]>,
|
|
|
|
getLabelCreationDate?: (
|
|
|
|
issue: Issue,
|
|
|
|
label: string
|
2021-09-20 21:37:32 +08:00
|
|
|
) => Promise<string | undefined>,
|
|
|
|
getPullRequest?: (issue: Issue) => Promise<IPullRequest | undefined | void>
|
2021-03-02 04:34:35 +08:00
|
|
|
) {
|
|
|
|
super(options);
|
|
|
|
|
|
|
|
if (getIssues) {
|
|
|
|
this.getIssues = getIssues;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (listIssueComments) {
|
|
|
|
this.listIssueComments = listIssueComments;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getLabelCreationDate) {
|
|
|
|
this.getLabelCreationDate = getLabelCreationDate;
|
|
|
|
}
|
2021-09-20 21:37:32 +08:00
|
|
|
|
|
|
|
if (getPullRequest) {
|
|
|
|
this.getPullRequest = getPullRequest;
|
|
|
|
}
|
2021-03-02 04:34:35 +08:00
|
|
|
}
|
|
|
|
}
|