Skip to content

Commit bfd6f2a

Browse files
committed
Split up UI tests from detection tests.
1 parent 6babc34 commit bfd6f2a

File tree

6 files changed

+450
-302
lines changed

6 files changed

+450
-302
lines changed

tests/corpus-fixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const describe = baseDescribe
3939
export { expect }
4040

4141
// Fluent interface for any corpus type (HAR or HTML)
42-
export function forCorpus(corpusKey: keyof typeof CORPUS) {
42+
export function withCorpus(corpusKey: keyof typeof CORPUS) {
4343
return {
4444
it: (name: string, fn: () => void | Promise<void>) => {
4545
return baseTest(`${String(corpusKey)}:${name}`, async () => {
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`github detection > gh_issue:should detect correct spots 1`] = `
4+
[
5+
{
6+
"for": "id=:rn: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
7+
"spot": {
8+
"domain": "github.com",
9+
"number": 523,
10+
"slug": "diffplug/selfie",
11+
"title": "[jvm] docs for VCR",
12+
"type": "GH_ISSUE_ADD_COMMENT",
13+
"unique_key": "github.com:diffplug/selfie:523",
14+
},
15+
},
16+
]
17+
`;
18+
19+
exports[`github detection > gh_issue_edit:should detect correct spots 1`] = `
20+
[
21+
{
22+
"for": "id=:rc3: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
23+
"spot": {
24+
"type": "GH_EDIT_COMMENT",
25+
"unique_key": "github.com:diffplug/gitcasso:56:edit-body",
26+
},
27+
},
28+
{
29+
"for": "id=:ra7: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
30+
"spot": {
31+
"domain": "github.com",
32+
"number": 56,
33+
"slug": "diffplug/gitcasso",
34+
"title": "what about the draft?",
35+
"type": "GH_ISSUE_ADD_COMMENT",
36+
"unique_key": "github.com:diffplug/gitcasso:56",
37+
},
38+
},
39+
]
40+
`;
41+
42+
exports[`github detection > gh_issue_new:should detect correct spots 1`] = `
43+
[
44+
{
45+
"for": "id=:r34: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
46+
"spot": {
47+
"domain": "github.com",
48+
"slug": "diffplug/gitcasso",
49+
"title": "New issue title",
50+
"type": "GH_ISSUE_NEW_COMMENT",
51+
"unique_key": "github.com:diffplug/gitcasso:new",
52+
},
53+
},
54+
]
55+
`;
56+
57+
exports[`github detection > gh_new_pr:should detect correct spots 1`] = `
58+
[
59+
{
60+
"for": "id=feedback name=feedback className=form-control width-full mb-2",
61+
"spot": "NO_SPOT",
62+
},
63+
{
64+
"for": "id=pull_request_body name=pull_request[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 CommentBox-input--large overtype-input",
65+
"spot": {
66+
"base": "main",
67+
"domain": "github.com",
68+
"head": "cavia-porcellus:selfie:main",
69+
"slug": "diffplug/selfie",
70+
"title": "Update README.md",
71+
"type": "GH_PR_NEW_COMMENT",
72+
"unique_key": "github.com:diffplug/selfie:main...cavia-porcellus:selfie:main",
73+
},
74+
},
75+
]
76+
`;
77+
78+
exports[`github detection > gh_pr:should detect correct spots 1`] = `
79+
[
80+
{
81+
"for": "id=feedback name=feedback className=form-control width-full mb-2",
82+
"spot": "NO_SPOT",
83+
},
84+
{
85+
"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",
86+
"spot": {
87+
"domain": "github.com",
88+
"number": 517,
89+
"slug": "diffplug/selfie",
90+
"title": "Add "VCR" functionality
91+
#517",
92+
"type": "GH_PR_ADD_COMMENT",
93+
"unique_key": "github.com:diffplug/selfie:517",
94+
},
95+
},
96+
]
97+
`;
98+
99+
exports[`github detection > gh_pr_edit:should detect correct spots 1`] = `
100+
[
101+
{
102+
"for": "id=issue-3429313834-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 focus-visible overtype-input",
103+
"spot": {
104+
"type": "GH_EDIT_COMMENT",
105+
"unique_key": "github.com:diffplug/gitcasso:58:edit-body",
106+
},
107+
},
108+
{
109+
"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",
110+
"spot": {
111+
"domain": "github.com",
112+
"number": 58,
113+
"slug": "diffplug/gitcasso",
114+
"title": "Feat/expand corpus
115+
116+
#58",
117+
"type": "GH_PR_ADD_COMMENT",
118+
"unique_key": "github.com:diffplug/gitcasso:58",
119+
},
120+
},
121+
]
122+
`;
123+
124+
exports[`github detection > gh_project:should detect correct spots 1`] = `[]`;
125+
126+
exports[`github detection > gh_project_draft:should detect correct spots 1`] = `[]`;
127+
128+
exports[`github detection > gh_project_draft_edit:should detect correct spots 1`] = `
129+
[
130+
{
131+
"for": "id=:r5a: name=null className=prc-Textarea-TextArea-13q4j",
132+
"spot": "NO_SPOT",
133+
},
134+
]
135+
`;
136+
137+
exports[`github detection > gh_project_issue:should detect correct spots 1`] = `
138+
[
139+
{
140+
"for": "id=:rbs: name=null className=prc-Textarea-TextArea-13q4j",
141+
"spot": "NO_SPOT",
142+
},
143+
]
144+
`;
145+
146+
exports[`github detection > gh_project_issue_edit:should detect correct spots 1`] = `
147+
[
148+
{
149+
"for": "id=:rdh: name=null className=prc-Textarea-TextArea-13q4j",
150+
"spot": "NO_SPOT",
151+
},
152+
{
153+
"for": "id=:rbs: name=null className=prc-Textarea-TextArea-13q4j",
154+
"spot": "NO_SPOT",
155+
},
156+
]
157+
`;
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`github ui > gh_issue:should render correct UI elements 1`] = `
4+
[
5+
{
6+
"for": "id=:rn: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
7+
"title": "[jvm] docs for VCR",
8+
"upperDecoration": <React.Fragment>
9+
<span
10+
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
11+
>
12+
<IssueOpenedIcon
13+
size={16}
14+
/>
15+
</span>
16+
#
17+
523
18+
<a
19+
className="truncate hover:underline"
20+
href="https://github.com/diffplug/selfie"
21+
>
22+
diffplug/selfie
23+
</a>
24+
</React.Fragment>,
25+
},
26+
]
27+
`;
28+
29+
exports[`github ui > gh_issue_edit:should render correct UI elements 1`] = `
30+
[
31+
{
32+
"for": "id=:rc3: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
33+
"title": "N/A",
34+
"upperDecoration": <span>
35+
N/A
36+
</span>,
37+
},
38+
{
39+
"for": "id=:ra7: name=null className=prc-Textarea-TextArea-13q4j overtype-input",
40+
"title": "what about the draft?",
41+
"upperDecoration": <React.Fragment>
42+
<span
43+
className="flex h-4 w-4 flex-shrink-0 items-center justify-center"
44+
>
45+
<IssueOpenedIcon
46+
size={16}
47+
/>
48+
</span>
49+
#
50+
56
51+
<a
52+
className="truncate hover:underline"
53+
href="https://github.com/diffplug/gitcasso"
54+
>
55+
diffplug/gitcasso
56+
</a>
57+
</React.Fragment>,
58+
},
59+
]
60+
`;
61+
62+
exports[`github ui > gh_issue_new:should render correct UI elements 1`] = `
63+
[
64+
{
65+
"for": "id=:r34: name=null className=prc-Textarea-TextArea-13q4j focus-visible overtype-input",
66+
"title": "New issue title",
67+
"upperDecoration": <React.Fragment>
68+
<span>
69+
New Issue
70+
</span>
71+
<span
72+
className="font-mono text-muted-foreground text-sm"
73+
>
74+
75+
diffplug/gitcasso
76+
77+
</span>
78+
</React.Fragment>,
79+
},
80+
]
81+
`;
82+
83+
exports[`github ui > gh_new_pr:should render correct UI elements 1`] = `
84+
[
85+
{
86+
"for": "id=feedback name=feedback className=form-control width-full mb-2",
87+
"title": null,
88+
"upperDecoration": null,
89+
},
90+
{
91+
"for": "id=pull_request_body name=pull_request[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 CommentBox-input--large overtype-input",
92+
"title": "Update README.md",
93+
"upperDecoration": <React.Fragment>
94+
<span>
95+
New PR
96+
</span>
97+
<span
98+
className="font-mono text-muted-foreground text-sm"
99+
>
100+
101+
diffplug/selfie
102+
103+
</span>
104+
</React.Fragment>,
105+
},
106+
]
107+
`;
108+
109+
exports[`github ui > gh_pr:should render correct UI elements 1`] = `
110+
[
111+
{
112+
"for": "id=feedback name=feedback className=form-control width-full mb-2",
113+
"title": null,
114+
"upperDecoration": null,
115+
},
116+
{
117+
"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",
118+
"title": "Add "VCR" functionality
119+
#517",
120+
"upperDecoration": <React.Fragment>
121+
<span
122+
className="font-mono text-muted-foreground text-sm"
123+
>
124+
diffplug/selfie
125+
</span>
126+
<span
127+
className="ml-2 font-medium"
128+
>
129+
PR #
130+
517
131+
</span>
132+
</React.Fragment>,
133+
},
134+
]
135+
`;
136+
137+
exports[`github ui > gh_pr_edit:should render correct UI elements 1`] = `
138+
[
139+
{
140+
"for": "id=issue-3429313834-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 focus-visible overtype-input",
141+
"title": "N/A",
142+
"upperDecoration": <span>
143+
N/A
144+
</span>,
145+
},
146+
{
147+
"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",
148+
"title": "Feat/expand corpus
149+
150+
#58",
151+
"upperDecoration": <React.Fragment>
152+
<span
153+
className="font-mono text-muted-foreground text-sm"
154+
>
155+
diffplug/gitcasso
156+
</span>
157+
<span
158+
className="ml-2 font-medium"
159+
>
160+
PR #
161+
58
162+
</span>
163+
</React.Fragment>,
164+
},
165+
]
166+
`;
167+
168+
exports[`github ui > gh_project:should render correct UI elements 1`] = `[]`;
169+
170+
exports[`github ui > gh_project_draft:should render correct UI elements 1`] = `[]`;
171+
172+
exports[`github ui > gh_project_draft_edit:should render correct UI elements 1`] = `
173+
[
174+
{
175+
"for": "id=:r5a: name=null className=prc-Textarea-TextArea-13q4j",
176+
"title": null,
177+
"upperDecoration": null,
178+
},
179+
]
180+
`;
181+
182+
exports[`github ui > gh_project_issue:should render correct UI elements 1`] = `
183+
[
184+
{
185+
"for": "id=:rbs: name=null className=prc-Textarea-TextArea-13q4j",
186+
"title": null,
187+
"upperDecoration": null,
188+
},
189+
]
190+
`;
191+
192+
exports[`github ui > gh_project_issue_edit:should render correct UI elements 1`] = `
193+
[
194+
{
195+
"for": "id=:rdh: name=null className=prc-Textarea-TextArea-13q4j",
196+
"title": null,
197+
"upperDecoration": null,
198+
},
199+
{
200+
"for": "id=:rbs: name=null className=prc-Textarea-TextArea-13q4j",
201+
"title": null,
202+
"upperDecoration": null,
203+
},
204+
]
205+
`;

0 commit comments

Comments
 (0)