Skip to content

Commit

Permalink
Fixed tests for decode function
Browse files Browse the repository at this point in the history
  • Loading branch information
bminer committed Jan 23, 2019
1 parent fe384b5 commit bcc6e4e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestDecode(t *testing.T) {

decoded := []DecodeType{}

err := decode(data, &decoded)
err := decode([]influxModels.Row{data}, &decoded)
if err != nil {
t.Error("Error decoding: ", err)
}
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestDecodeMissingColumn(t *testing.T) {
expected := []DecodeType{{1, 0}}
data.Values = append(data.Values, []interface{}{1})
decoded := []DecodeType{}
err := decode(data, &decoded)
err := decode([]influxModels.Row{data}, &decoded)

if err != nil {
t.Error("UnExpected error decoding: ", data, &decoded)
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestDecodeWrongType(t *testing.T) {
expected := []DecodeType{{1, 2.0}}
data.Values = append(data.Values, []interface{}{1.0, 2})
decoded := []DecodeType{}
err := decode(data, &decoded)
err := decode([]influxModels.Row{data}, &decoded)
if err != nil {
t.Error("Unexpected error decoding: ", err, data, decoded)
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestDecodeTime(t *testing.T) {
expected := []DecodeType{{ti, 2.0}}
data.Values = append(data.Values, []interface{}{timeS, 2.0})
decoded := []DecodeType{}
err = decode(data, &decoded)
err = decode([]influxModels.Row{data}, &decoded)

if err != nil {
t.Error("Error decoding: ", err)
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestDecodeJsonNumber(t *testing.T) {
expected := []DecodeType{{1, 2.0}}
data.Values = append(data.Values, []interface{}{json.Number("1"), json.Number("2.0")})
decoded := []DecodeType{}
err := decode(data, &decoded)
err := decode([]influxModels.Row{data}, &decoded)

if err != nil {
t.Error("Error decoding: ", err)
Expand Down Expand Up @@ -212,7 +212,7 @@ func TestDecodeUnsedStructValue(t *testing.T) {
expected := []DecodeType{{1, 0}}
data.Values = append(data.Values, []interface{}{1, 1.1})
decoded := []DecodeType{}
err := decode(data, &decoded)
err := decode([]influxModels.Row{data}, &decoded)

if err != nil {
t.Error("Error decoding: ", err)
Expand Down Expand Up @@ -243,7 +243,7 @@ func TestDecodeMeasure(t *testing.T) {
expected := []DecodeType{{"bla", 1, 0}}
data.Values = append(data.Values, []interface{}{1, 1.1})
decoded := []DecodeType{}
err := decode(data, &decoded)
err := decode([]influxModels.Row{data}, &decoded)

if decoded[0].InfluxMeasurement != expected[0].InfluxMeasurement {
t.Error("Decoded Wrong measure")
Expand Down

0 comments on commit bcc6e4e

Please sign in to comment.