Files
parasocial/internal/twitch/service_bench_test.go
ruinivist 7acb293dea test: add benchmarks for various components
Adds benchmarking tests to ensure the application remains low on resources.
Covers payload parsing, auth verification, IRC chat line formatting, and more.
2026-05-31 23:13:18 +00:00

36 lines
746 B
Go

package twitch
import "testing"
func BenchmarkBuildMinuteWatchedPayload(b *testing.B) {
userID := "user123"
channelID := "channel456"
login := "streamer"
metadata := &StreamMetadata{
BroadcastID: "bc123",
Game: &Game{Name: "Science", ID: "123"},
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = BuildMinuteWatchedPayload(userID, channelID, login, metadata)
}
}
func BenchmarkEncodeMinuteWatchedPayload(b *testing.B) {
payload := MinuteWatchedPayload{
{
Event: "minute_watched",
Properties: minuteWatchedProperties{
ChannelID: "channel456",
BroadcastID: "bc123",
Player: "site",
UserID: "user123",
},
},
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = payload.Encode()
}
}