forked from graphql-go/graphql
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathquoted_or_list_internal_test.go
More file actions
35 lines (33 loc) · 991 Bytes
/
quoted_or_list_internal_test.go
File metadata and controls
35 lines (33 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)
}
}