Skip to content

Commit 64e0449

Browse files
authored
fix(twitch): Update Twitch detector to handle new RawV2 field and adjust test expectations (#4150)
1 parent 3fe3907 commit 64e0449

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

pkg/detectors/twitch/twitch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
6363
s1 := detectors.Result{
6464
DetectorType: detectorspb.DetectorType_Twitch,
6565
Raw: []byte(id),
66+
RawV2: []byte(id + ":" + secret),
6667
}
6768

6869
if verify {

pkg/detectors/twitch/twitch_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func TestTwitch_FromChunk(t *testing.T) {
153153
t.Errorf("Twitch.FromData() verificationError = %v, wantVerificationErr %v", got[i].VerificationError(), tt.wantVerificationErr)
154154
}
155155
}
156-
ignoreOpts := cmpopts.IgnoreFields(detectors.Result{}, "Raw", "verificationError")
156+
ignoreOpts := cmpopts.IgnoreFields(detectors.Result{}, "Raw", "RawV2", "verificationError")
157157
if diff := cmp.Diff(got, tt.want, ignoreOpts); diff != "" {
158158
t.Errorf("Twitch.FromData() %s diff: (-got +want)\n%s", tt.name, diff)
159159
}

pkg/detectors/twitch/twitch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestTwitch_Pattern(t *testing.T) {
3030
{
3131
name: "valid pattern - with keyword twitch",
3232
input: fmt.Sprintf("%s token - '%s'\n%s token - '%s'\n", keyword, validKey, keyword, validId),
33-
want: []string{validKey, validId},
33+
want: []string{validId + ":" + validKey, validKey + ":" + validId},
3434
},
3535
{
3636
name: "invalid pattern",

0 commit comments

Comments
 (0)