28 lines
727 B
Go
28 lines
727 B
Go
|
|
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 TestMediaConversationFieldsExcludeEngagement(t *testing.T) {
|
||
|
|
if fieldInList(mediaConversationFields, "like_count") {
|
||
|
|
t.Fatalf("mediaConversationFields must not request like_count: %q", mediaConversationFields)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func fieldInList(fields, name string) bool {
|
||
|
|
for _, part := range strings.Split(fields, ",") {
|
||
|
|
if strings.TrimSpace(part) == name {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|