-
Notifications
You must be signed in to change notification settings - Fork 349
/
issues-processor-mock.ts
47 lines (41 loc) · 1.38 KB
/
issues-processor-mock.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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';
import {IPullRequest} from '../../src/interfaces/pull-request';
import {IState} from '../../src/interfaces/state/state';
import {IIssueEvent} from '../../src/interfaces/issue-event';
export class IssuesProcessorMock extends IssuesProcessor {
constructor(
options: IIssuesProcessorOptions,
state: IState,
getIssues?: (page: number) => Promise<Issue[]>,
listIssueComments?: (
issue: Issue,
sinceDate: string
) => Promise<IComment[]>,
getLabelCreationDate?: (
issue: Issue,
label: string
) => Promise<string | undefined>,
getPullRequest?: (issue: Issue) => Promise<IPullRequest | undefined | void>,
getIssueEvents?: (issue: Issue) => Promise<IIssueEvent[]>
) {
super(options, state);
if (getIssues) {
this.getIssues = getIssues;
}
if (listIssueComments) {
this.listIssueComments = listIssueComments;
}
if (getLabelCreationDate) {
this.getLabelCreationDate = getLabelCreationDate;
}
if (getPullRequest) {
this.getPullRequest = getPullRequest;
}
if (getIssueEvents) {
this.getIssueEvents = getIssueEvents;
}
}
}