Skip to content

Commit 625faa2

Browse files
committed
refactor: use inline snapshotting
1 parent b586b32 commit 625faa2

File tree

36 files changed

+737
-647
lines changed

36 files changed

+737
-647
lines changed

src/eventsub/automod/message/hold.rs

Lines changed: 203 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,54 @@ fn parse_payload_v1() {
114114
"held_at": "2024-10-19T20:11:16.799750627Z"
115115
}
116116
}
117-
"##
117+
"##,
118+
@r#"
119+
AutomodMessageHoldV1(
120+
Payload {
121+
subscription: EventSubscriptionInformation {
122+
id: "e523fda0-01b6-4b0e-9024-a5a80c5ad680",
123+
status: Enabled,
124+
cost: 0,
125+
condition: AutomodMessageHoldV1 {
126+
broadcaster_user_id: "129546453",
127+
moderator_user_id: "129546453",
128+
},
129+
created_at: "2024-10-19T20:11:13.917500523Z",
130+
transport: Websocket(
131+
WebsocketTransportResponse {
132+
session_id: "AgoQRniKAQ1ITYSESh4ku8anEBIGY2VsbC1j",
133+
connected_at: None,
134+
disconnected_at: None,
135+
},
136+
),
137+
type_: AutomodMessageHold,
138+
version: "1",
139+
},
140+
message: Notification(
141+
AutomodMessageHoldV1Payload {
142+
broadcaster_user_id: "129546453",
143+
broadcaster_user_login: "nerixyz",
144+
broadcaster_user_name: "nerixyz",
145+
user_id: "489584266",
146+
user_login: "uint128",
147+
user_name: "uint128",
148+
message_id: "332e99ac-e19c-4368-a15b-793e8266b51f",
149+
message: AutomodMessage {
150+
text: "boobs",
151+
fragments: [
152+
Text {
153+
text: "boobs",
154+
},
155+
],
156+
},
157+
category: Sexwords,
158+
level: 4,
159+
held_at: "2024-10-19T20:11:16.799750627Z",
160+
},
161+
),
162+
},
163+
)
164+
"#
118165
);
119166
}
120167

@@ -244,7 +291,67 @@ fn parse_payload_v2_automod() {
244291
"held_at": "2024-11-18T16:59:46.323937273Z"
245292
}
246293
}
247-
"##
294+
"##,
295+
@r#"
296+
AutomodMessageHoldV2(
297+
Payload {
298+
subscription: EventSubscriptionInformation {
299+
id: "85c8dcb0-7af4-4581-b684-32087d386384",
300+
status: Enabled,
301+
cost: 0,
302+
condition: AutomodMessageHoldV2 {
303+
broadcaster_user_id: "129546453",
304+
moderator_user_id: "129546453",
305+
},
306+
created_at: "2024-11-18T16:36:08.691979783Z",
307+
transport: Websocket(
308+
WebsocketTransportResponse {
309+
session_id: "AgoQREw4FYBWQ5quz4J-S4VYkRIGY2VsbC1j",
310+
connected_at: None,
311+
disconnected_at: None,
312+
},
313+
),
314+
type_: AutomodMessageHold,
315+
version: "2",
316+
},
317+
message: Notification(
318+
AutomodMessageHoldV2Payload {
319+
broadcaster_user_id: "129546453",
320+
broadcaster_user_login: "nerixyz",
321+
broadcaster_user_name: "nerixyz",
322+
user_id: "489584266",
323+
user_login: "uint128",
324+
user_name: "uint128",
325+
message_id: "78ccd959-3e7e-4f8d-bd8b-f92c359b0a7d",
326+
message: AutomodMessage {
327+
text: "😂 ass",
328+
fragments: [
329+
Text {
330+
text: "😂 ",
331+
},
332+
Text {
333+
text: "ass",
334+
},
335+
],
336+
},
337+
reason: Automod(
338+
AutomodMessageInfo {
339+
category: Swearing,
340+
level: 4,
341+
boundaries: [
342+
AutomodMessageBoundary {
343+
start_pos: 2,
344+
end_pos: 4,
345+
},
346+
],
347+
},
348+
),
349+
held_at: "2024-11-18T16:59:46.323937273Z",
350+
},
351+
),
352+
},
353+
)
354+
"#
248355
);
249356
}
250357

@@ -356,6 +463,99 @@ fn parse_payload_v2_blocked_term() {
356463
"held_at": "2024-11-18T16:58:41.476117057Z"
357464
}
358465
}
359-
"##
466+
"##,
467+
@r#"
468+
AutomodMessageHoldV2(
469+
Payload {
470+
subscription: EventSubscriptionInformation {
471+
id: "85c8dcb0-7af4-4581-b684-32087d386384",
472+
status: Enabled,
473+
cost: 0,
474+
condition: AutomodMessageHoldV2 {
475+
broadcaster_user_id: "129546453",
476+
moderator_user_id: "129546453",
477+
},
478+
created_at: "2024-11-18T16:36:08.691979783Z",
479+
transport: Websocket(
480+
WebsocketTransportResponse {
481+
session_id: "AgoQREw4FYBWQ5quz4J-S4VYkRIGY2VsbC1j",
482+
connected_at: None,
483+
disconnected_at: None,
484+
},
485+
),
486+
type_: AutomodMessageHold,
487+
version: "2",
488+
},
489+
message: Notification(
490+
AutomodMessageHoldV2Payload {
491+
broadcaster_user_id: "129546453",
492+
broadcaster_user_login: "nerixyz",
493+
broadcaster_user_name: "nerixyz",
494+
user_id: "489584266",
495+
user_login: "uint128",
496+
user_name: "uint128",
497+
message_id: "dcfc6b48-0fd1-446c-8cf5-d1810bb55b73",
498+
message: AutomodMessage {
499+
text: "boobs Kappa 😂😂 foo private",
500+
fragments: [
501+
Text {
502+
text: "boobs",
503+
},
504+
Text {
505+
text: " ",
506+
},
507+
Emote {
508+
text: "Kappa",
509+
emote: AutomodMessageEmote {
510+
id: "25",
511+
emote_set_id: "0",
512+
},
513+
},
514+
Text {
515+
text: " 😂😂 ",
516+
},
517+
Text {
518+
text: "foo",
519+
},
520+
Text {
521+
text: " ",
522+
},
523+
Text {
524+
text: "private",
525+
},
526+
],
527+
},
528+
reason: BlockedTerm(
529+
AutomodBlockedTermInfo {
530+
terms_found: [
531+
AutomodBlockedTerm {
532+
term_id: "e4d4f1ba-99bf-4b19-9875-cd4eda98ead9",
533+
boundary: AutomodMessageBoundary {
534+
start_pos: 15,
535+
end_pos: 17,
536+
},
537+
owner_broadcaster_user_id: "129546453",
538+
owner_broadcaster_user_login: "nerixyz",
539+
owner_broadcaster_user_name: "nerixyz",
540+
},
541+
AutomodBlockedTerm {
542+
term_id: "e60a94ea-e5d9-444e-a114-4cfd2f86c6ad",
543+
boundary: AutomodMessageBoundary {
544+
start_pos: 19,
545+
end_pos: 25,
546+
},
547+
owner_broadcaster_user_id: "129546453",
548+
owner_broadcaster_user_login: "nerixyz",
549+
owner_broadcaster_user_name: "nerixyz",
550+
},
551+
],
552+
},
553+
),
554+
held_at: "2024-11-18T16:58:41.476117057Z",
555+
},
556+
),
557+
},
558+
)
559+
"#
360560
);
361561
}

src/eventsub/automod/message/snapshots/twitch_api__eventsub__automod__message__hold__parse_payload_v1.snap

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/eventsub/automod/message/snapshots/twitch_api__eventsub__automod__message__hold__parse_payload_v2_automod.snap

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)