added test case

This commit is contained in:
reesporte 2021-12-06 16:16:43 -06:00
parent 060c73fb2f
commit 716a3a89c1

View file

@ -168,3 +168,22 @@ func TestEncodeDecodeDistinctTimestamp(t *testing.T) {
t.Errorf("failed to encode DistinctTimestamp. expected %v got %v", &pbTime, encoded)
}
}
func TestDecodeQueryResult(t *testing.T) {
t.Run("DistinctTimestamp", func(t *testing.T) {
pbTime := pb.DistinctTimestamp{
Values: []string{"this", "is", "fake", "timestamp", "values"},
Name: "pbtime",
}
piloTime := pilosa.DistinctTimestamp{
Values: []string{"this", "is", "fake", "timestamp", "values"},
Name: "pbtime",
}
q := &pb.QueryResult{Type: queryResultTypeDistinctTimestamp, DistinctTimestamp: &pbTime}
s := Serializer{}
decoded := s.decodeQueryResult(q)
if !reflect.DeepEqual(decoded, piloTime) {
t.Errorf("failed to decode DistinctTimestamp. expected %v got %v", piloTime, decoded)
}
})
}