mirror of
https://github.com/VinGarcia/ksql.git
synced 2025-05-31 11:42:25 +00:00
Finish writing tests for ParseInputFunc()
This commit is contained in:
parent
898bb887cc
commit
db6b126c69
@ -1,6 +1,7 @@
|
|||||||
package structs_test
|
package structs_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/vingarcia/ksql/internal/structs"
|
"github.com/vingarcia/ksql/internal/structs"
|
||||||
@ -14,7 +15,11 @@ type user struct {
|
|||||||
|
|
||||||
func TestParseInputFunc(t *testing.T) {
|
func TestParseInputFunc(t *testing.T) {
|
||||||
t.Run("should parse a function correctly", func(t *testing.T) {
|
t.Run("should parse a function correctly", func(t *testing.T) {
|
||||||
|
chunkType, err := structs.ParseInputFunc(func(users []user) error {
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
tt.AssertNoErr(t, err)
|
||||||
|
tt.AssertEqual(t, reflect.TypeOf([]user{}), chunkType)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("should return errors correctly", func(t *testing.T) {
|
t.Run("should return errors correctly", func(t *testing.T) {
|
||||||
@ -56,7 +61,7 @@ func TestParseInputFunc(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "input function argument is not slice",
|
desc: "input function argument is not slice",
|
||||||
fn: func(users []string) error {
|
fn: func(users user) error {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
expectErrToContain: []string{"ForEachChunk", "must a slice"},
|
expectErrToContain: []string{"ForEachChunk", "must a slice"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user