Skip to content

Commit e0109ce

Browse files
committed
Add snapshots for the multi-edit case, which shows that actually edited non-root comments on issues are actually being registered as GH_ISSUE_APPEND
1 parent bc3c684 commit e0109ce

File tree

5 files changed

+9208
-2
lines changed

5 files changed

+9208
-2
lines changed

tests/corpus/_corpus-index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ export const CORPUS: Record<string, CorpusEntry> = {
1414
},
1515
// HAR corpus (initial page loads)
1616
gh_issue_edit: {
17-
description: 'editing an existing comment on an issue',
17+
description: 'edit an existing comment on an issue',
1818
type: 'html',
1919
url: 'https://github.com/diffplug/gitcasso/issues/56',
2020
},
21+
gh_issue_edit_multiple: {
22+
description: 'edit an existing comment on an issue (root and appended)',
23+
type: 'html',
24+
url: 'https://github.com/diffplug/testing-deletable/issues/3',
25+
},
2126
gh_issue_new: {
2227
description: 'a new issue wiht some fields filled out',
2328
type: 'html',
@@ -28,10 +33,15 @@ export const CORPUS: Record<string, CorpusEntry> = {
2833
url: 'https://github.com/diffplug/selfie/pull/517',
2934
},
3035
gh_pr_edit: {
31-
description: 'editing an existing comment on a PR',
36+
description: 'edit an existing comment on a PR',
3237
type: 'html',
3338
url: 'https://github.com/diffplug/gitcasso/pull/58',
3439
},
40+
gh_pr_edit_multiple: {
41+
description: 'edit an existing comment on a PR (root and appended)',
42+
type: 'html',
43+
url: 'https://github.com/diffplug/testing-deletable/pull/5',
44+
},
3545
gh_pr_new: {
3646
type: 'har',
3747
url: 'https://github.com/diffplug/selfie/compare/main...cavia-porcellus:selfie:main?expand=1',

tests/corpus/gh_issue_edit_multiple.html

Lines changed: 1532 additions & 0 deletions
Large diffs are not rendered by default.

tests/corpus/gh_pr_edit_multiple.html

Lines changed: 7501 additions & 0 deletions
Large diffs are not rendered by default.

tests/lib/enhancers/__snapshots__/gh-detection.test.ts.snap

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,41 @@ exports[`github detection > gh_issue_edit:should detect correct spots 1`] = `
4040
]
4141
`;
4242

43+
exports[`github detection > gh_issue_edit_multiple:should detect correct spots 1`] = `
44+
[
45+
{
46+
"for": "id=:r76: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
47+
"spot": {
48+
"isIssue": true,
49+
"type": "GH_EDIT",
50+
"unique_key": "github.com:diffplug/testing-deletable:3:edit-body",
51+
},
52+
},
53+
{
54+
"for": "id=:r8k: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
55+
"spot": {
56+
"domain": "github.com",
57+
"number": 3,
58+
"slug": "diffplug/testing-deletable",
59+
"title": "Test 3",
60+
"type": "GH_ISSUE_APPEND",
61+
"unique_key": "github.com:diffplug/testing-deletable:3",
62+
},
63+
},
64+
{
65+
"for": "id=:r5b: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
66+
"spot": {
67+
"domain": "github.com",
68+
"number": 3,
69+
"slug": "diffplug/testing-deletable",
70+
"title": "Test 3",
71+
"type": "GH_ISSUE_APPEND",
72+
"unique_key": "github.com:diffplug/testing-deletable:3",
73+
},
74+
},
75+
]
76+
`;
77+
4378
exports[`github detection > gh_issue_new:should detect correct spots 1`] = `
4479
[
4580
{
@@ -102,6 +137,43 @@ exports[`github detection > gh_pr_edit:should detect correct spots 1`] = `
102137
]
103138
`;
104139

140+
exports[`github detection > gh_pr_edit_multiple:should detect correct spots 1`] = `
141+
[
142+
{
143+
"for": "id=issue-3454672384-body name=pull_request[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable CommentBox-input FormControl-textarea js-saved-reply-shortcut-comment-field overtype-input",
144+
"spot": {
145+
"isIssue": false,
146+
"type": "GH_EDIT",
147+
"unique_key": "github.com:diffplug/testing-deletable:5:edit-body",
148+
},
149+
},
150+
{
151+
"for": "id=convert-to-issue-body-3335416053 name=issue[body] className=form-control input-contrast comment-form-textarea js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable",
152+
"spot": "NO_SPOT",
153+
},
154+
{
155+
"for": "id=issuecomment-3335416053-body name=issue_comment[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable CommentBox-input FormControl-textarea js-saved-reply-shortcut-comment-field focus-visible overtype-input",
156+
"spot": {
157+
"isIssue": false,
158+
"type": "GH_EDIT",
159+
"unique_key": "github.com:diffplug/testing-deletable:5:edit-body",
160+
},
161+
},
162+
{
163+
"for": "id=new_comment_field name=comment[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit FormControl-textarea CommentBox-input js-size-to-fit size-to-fit js-session-resumable js-saved-reply-shortcut-comment-field overtype-input",
164+
"spot": {
165+
"domain": "github.com",
166+
"number": 5,
167+
"slug": "diffplug/testing-deletable",
168+
"title": "Update README.md
169+
#5",
170+
"type": "GH_PR_APPEND",
171+
"unique_key": "github.com:diffplug/testing-deletable:5",
172+
},
173+
},
174+
]
175+
`;
176+
105177
exports[`github detection > gh_pr_new:should detect correct spots 1`] = `
106178
[
107179
{

tests/lib/enhancers/__snapshots__/gh-ui.test.ts.snap

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,60 @@ exports[`github ui > gh_issue_edit:should render correct UI elements 1`] = `
5959
]
6060
`;
6161

62+
exports[`github ui > gh_issue_edit_multiple:should render correct UI elements 1`] = `
63+
[
64+
{
65+
"for": "id=:r76: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
66+
"title": "N/A",
67+
"upperDecoration": <span>
68+
N/A
69+
</span>,
70+
},
71+
{
72+
"for": "id=:r8k: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
73+
"title": "Test 3",
74+
"upperDecoration": <React.Fragment>
75+
<span
76+
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
77+
>
78+
<IssueOpenedIcon
79+
size={16}
80+
/>
81+
</span>
82+
#
83+
3
84+
<a
85+
className="truncate hover:underline"
86+
href="https://github.com/diffplug/testing-deletable"
87+
>
88+
diffplug/testing-deletable
89+
</a>
90+
</React.Fragment>,
91+
},
92+
{
93+
"for": "id=:r5b: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
94+
"title": "Test 3",
95+
"upperDecoration": <React.Fragment>
96+
<span
97+
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
98+
>
99+
<IssueOpenedIcon
100+
size={16}
101+
/>
102+
</span>
103+
#
104+
3
105+
<a
106+
className="truncate hover:underline"
107+
href="https://github.com/diffplug/testing-deletable"
108+
>
109+
diffplug/testing-deletable
110+
</a>
111+
</React.Fragment>,
112+
},
113+
]
114+
`;
115+
62116
exports[`github ui > gh_issue_new:should render correct UI elements 1`] = `
63117
[
64118
{
@@ -134,6 +188,43 @@ exports[`github ui > gh_pr_edit:should render correct UI elements 1`] = `
134188
]
135189
`;
136190

191+
exports[`github ui > gh_pr_edit_multiple:should render correct UI elements 1`] = `
192+
[
193+
{
194+
"for": "id=issue-3454672384-body name=pull_request[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable CommentBox-input FormControl-textarea js-saved-reply-shortcut-comment-field overtype-input",
195+
"title": "N/A",
196+
"upperDecoration": <span>
197+
N/A
198+
</span>,
199+
},
200+
{
201+
"for": "id=issuecomment-3335416053-body name=issue_comment[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit js-size-to-fit size-to-fit js-session-resumable CommentBox-input FormControl-textarea js-saved-reply-shortcut-comment-field focus-visible overtype-input",
202+
"title": "N/A",
203+
"upperDecoration": <span>
204+
N/A
205+
</span>,
206+
},
207+
{
208+
"for": "id=new_comment_field name=comment[body] className=js-comment-field js-paste-markdown js-task-list-field js-quick-submit FormControl-textarea CommentBox-input js-size-to-fit size-to-fit js-session-resumable js-saved-reply-shortcut-comment-field overtype-input",
209+
"title": "Update README.md
210+
#5",
211+
"upperDecoration": <React.Fragment>
212+
<span
213+
className="font-mono text-muted-foreground text-sm"
214+
>
215+
diffplug/testing-deletable
216+
</span>
217+
<span
218+
className="ml-2 font-medium"
219+
>
220+
PR #
221+
5
222+
</span>
223+
</React.Fragment>,
224+
},
225+
]
226+
`;
227+
137228
exports[`github ui > gh_pr_new:should render correct UI elements 1`] = `
138229
[
139230
{

0 commit comments

Comments
 (0)