Skip to content

Commit 9915997

Browse files
test: scope sanitization fixture names to avoid package-wide collisions
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b8dd0f23-2c6e-47c1-bad5-c1d0c9361f13
1 parent 57d4875 commit 9915997

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

pkg/github/minimal_types_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,45 @@ import (
1010
"github.com/stretchr/testify/require"
1111
)
1212

13-
// bodyWithHiddenPayload embeds Unicode tag characters, which are invisible to a
13+
// sanitizedBodyWithHiddenChars embeds Unicode tag characters, which are invisible to a
1414
// human reviewer but legible to a model.
15-
const bodyWithHiddenPayload = "Looks good\U000E0001\U000E0049\U000E0067\U000E006E\U000E006F\U000E0072\U000E0065"
15+
const sanitizedBodyWithHiddenChars = "Looks good\U000E0001\U000E0049\U000E0067\U000E006E\U000E006F\U000E0072\U000E0065"
1616

17-
const bodyWithCode = "Compare with:\n```go\nif a<b { fmt.Println(\"x\") }\n```\nand <Foo/> in JSX."
17+
const sanitizedBodyWithCode = "Compare with:\n```go\nif a<b { fmt.Println(\"x\") }\n```\nand <Foo/> in JSX."
1818

1919
func TestConvertToMinimalIssueCommentSanitizesBody(t *testing.T) {
2020
t.Run("strips hidden characters", func(t *testing.T) {
2121
m := convertToMinimalIssueComment(&github.IssueComment{
2222
ID: github.Ptr(int64(1)),
23-
Body: github.Ptr(bodyWithHiddenPayload),
23+
Body: github.Ptr(sanitizedBodyWithHiddenChars),
2424
})
2525
assert.Equal(t, "Looks good", m.Body)
2626
})
2727

2828
t.Run("preserves code content", func(t *testing.T) {
2929
m := convertToMinimalIssueComment(&github.IssueComment{
3030
ID: github.Ptr(int64(1)),
31-
Body: github.Ptr(bodyWithCode),
31+
Body: github.Ptr(sanitizedBodyWithCode),
3232
})
33-
assert.Equal(t, bodyWithCode, m.Body)
33+
assert.Equal(t, sanitizedBodyWithCode, m.Body)
3434
})
3535
}
3636

3737
func TestConvertToMinimalPullRequestReviewSanitizesBody(t *testing.T) {
3838
t.Run("strips hidden characters", func(t *testing.T) {
3939
m := convertToMinimalPullRequestReview(&github.PullRequestReview{
4040
ID: github.Ptr(int64(1)),
41-
Body: github.Ptr(bodyWithHiddenPayload),
41+
Body: github.Ptr(sanitizedBodyWithHiddenChars),
4242
})
4343
assert.Equal(t, "Looks good", m.Body)
4444
})
4545

4646
t.Run("preserves code content", func(t *testing.T) {
4747
m := convertToMinimalPullRequestReview(&github.PullRequestReview{
4848
ID: github.Ptr(int64(1)),
49-
Body: github.Ptr(bodyWithCode),
49+
Body: github.Ptr(sanitizedBodyWithCode),
5050
})
51-
assert.Equal(t, bodyWithCode, m.Body)
51+
assert.Equal(t, sanitizedBodyWithCode, m.Body)
5252
})
5353
}
5454

@@ -58,7 +58,7 @@ func TestConvertToMinimalReviewCommentSanitizesBody(t *testing.T) {
5858

5959
t.Run("strips hidden characters", func(t *testing.T) {
6060
m := convertToMinimalReviewComment(reviewCommentNode{
61-
Body: githubv4.String(bodyWithHiddenPayload),
61+
Body: githubv4.String(sanitizedBodyWithHiddenChars),
6262
Path: githubv4.String("main.go"),
6363
URL: githubv4.URI{URL: commentURL},
6464
})
@@ -67,10 +67,10 @@ func TestConvertToMinimalReviewCommentSanitizesBody(t *testing.T) {
6767

6868
t.Run("preserves code content", func(t *testing.T) {
6969
m := convertToMinimalReviewComment(reviewCommentNode{
70-
Body: githubv4.String(bodyWithCode),
70+
Body: githubv4.String(sanitizedBodyWithCode),
7171
Path: githubv4.String("main.go"),
7272
URL: githubv4.URI{URL: commentURL},
7373
})
74-
assert.Equal(t, bodyWithCode, m.Body)
74+
assert.Equal(t, sanitizedBodyWithCode, m.Body)
7575
})
7676
}

0 commit comments

Comments
 (0)