func TestConnectionFromArray_CursorForObjectInConnection_ReturnsAnEdgeCursor_GivenAnArrayAndAMemberObject(t *testing.T) { letterBCursor := relay.CursorForObjectInConnection(arrayConnectionTestLetters, "B") expected := relay.ConnectionCursor("YXJyYXljb25uZWN0aW9uOjE=") if !reflect.DeepEqual(letterBCursor, expected) { t.Fatalf("wrong result, cursor result diff: %v", testutil.Diff(expected, letterBCursor)) } }
func TestConnectionFromArray_CursorForObjectInConnection_ReturnsEmptyCursor_GivenAnArrayAndANonMemberObject(t *testing.T) { letterFCursor := relay.CursorForObjectInConnection(arrayConnectionTestLetters, "F") if letterFCursor != "" { t.Fatalf("wrong result, expected empty cursor, got: %v", letterFCursor) } }