-
-
Notifications
You must be signed in to change notification settings - Fork 374
/
Copy pathFakePlatform.ts
91 lines (74 loc) · 2.36 KB
/
FakePlatform.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { GitDSL } from "../dsl/GitDSL"
import chainsmoker from "../commands/utils/chainsmoker"
import { Platform, Comment } from "./platform"
import { readFileSync } from "fs"
export class FakePlatform implements Platform {
public readonly name: string
constructor() {
this.name = "Fake"
}
async getReviewInfo(): Promise<any> {
return {}
}
async getPlatformReviewDSLRepresentation(): Promise<any> {
return {}
}
async getPlatformGitRepresentation(): Promise<GitDSL> {
return {
base: "456",
head: "123",
modified_files: [],
created_files: [],
deleted_files: [],
fileMatch: chainsmoker({ modified: [], created: [], deleted: [], edited: [] }),
diffForFile: async () => ({ before: "", after: "", diff: "", added: "", removed: "" }),
structuredDiffForFile: async () => ({ chunks: [], fromPath: undefined }),
JSONDiffForFile: async () => ({} as any),
JSONPatchForFile: async () => ({} as any),
commits: [
{
sha: "123",
author: { name: "1", email: "1", date: "1" },
committer: { name: "1", email: "1", date: "1" },
message: "456",
tree: { sha: "123", url: "123" },
url: "123",
},
],
linesOfCode: async () => 0,
}
}
async getInlineComments(_: string): Promise<Comment[]> {
return []
}
supportsCommenting() {
return true
}
supportsInlineComments() {
return true
}
async updateOrCreateComment(_dangerID: string, _newComment: string): Promise<string> {
return "https://github.com/orta/github-pages-with-jekyll/pull/5#issuecomment-383402256"
}
async createComment(_comment: string): Promise<any> {
return true
}
async createInlineComment(_git: GitDSL, _comment: string, _path: string, _line: number): Promise<any> {
return true
}
async updateInlineComment(_comment: string, _commentId: string): Promise<any> {
return true
}
async deleteInlineComment(_id: string): Promise<boolean> {
return true
}
async deleteMainComment(): Promise<boolean> {
return true
}
async updateStatus(): Promise<boolean> {
return true
}
getFileContents = (path: string) => new Promise<string>((res) => res(readFileSync(path, "utf8")))
createInlineReview?: (git: GitDSL, comments: { comment: string; path: string; line: number }[]) => Promise<any> =
undefined
}