thread-master/backend/internal/library/threadsapi/fields_test.go

28 lines
715 B
Go
Raw Normal View History

2026-06-30 07:09:44 +00:00
package threadsapi
import (
"strings"
"testing"
)
func TestUserThreadsListFieldsExcludeEngagement(t *testing.T) {
if fieldInList(userThreadsListFields, "like_count") || fieldInList(userThreadsListFields, "reply_count") {
t.Fatalf("userThreadsListFields must not request engagement fields: %q", userThreadsListFields)
}
}
func TestMediaReplyListFieldsExcludeEngagement(t *testing.T) {
if fieldInList(mediaReplyListFields, "like_count") {
t.Fatalf("mediaReplyListFields must not request like_count: %q", mediaReplyListFields)
}
}
func fieldInList(fields, name string) bool {
for _, part := range strings.Split(fields, ",") {
if strings.TrimSpace(part) == name {
return true
}
}
return false
}