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';
|
2023-06-24 05:13:39 +08:00
|
|
|
import {IState} from '../../src/interfaces/state/state';
|
2021-03-02 04:34:35 +08:00
|
|
|
|
|
|
|
export class IssuesProcessorMock extends IssuesProcessor {
|
|
|
|
constructor(
|
|
|
|
options: IIssuesProcessorOptions,
|
2023-06-22 19:20:34 +08:00
|
|
|
state: IState,
|
2021-03-02 04:34:35 +08:00
|
|
|
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
|
|
|
) {
|
2023-06-22 19:20:34 +08:00
|
|
|
super(options, state);
|
2021-03-02 04:34:35 +08:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|