Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (33 sloc) 991 Bytes
package graphql
import (
"reflect"
"testing"
)
func TestQuotedOrList_DoesNoAcceptAnEmptyList(t *testing.T) {
expected := ""
result := quotedOrList([]string{})
if !reflect.DeepEqual(expected, result) {
t.Fatalf("Expected %v, got: %v", expected, result)
}
}
func TestQuotedOrList_ReturnsSingleQuotedItem(t *testing.T) {
expected := `"A"`
result := quotedOrList([]string{"A"})
if !reflect.DeepEqual(expected, result) {
t.Fatalf("Expected %v, got: %v", expected, result)
}
}
func TestQuotedOrList_ReturnsTwoItems(t *testing.T) {
expected := `"A" or "B"`
result := quotedOrList([]string{"A", "B"})
if !reflect.DeepEqual(expected, result) {
t.Fatalf("Expected %v, got: %v", expected, result)
}
}
func TestQuotedOrList_ReturnsCommaSeparatedManyItemList(t *testing.T) {
expected := `"A", "B", "C", "D", or "E"`
result := quotedOrList([]string{"A", "B", "C", "D", "E", "F"})
if !reflect.DeepEqual(expected, result) {
t.Fatalf("Expected %v, got: %v", expected, result)
}
}
You can’t perform that action at this time.