From db6b126c698a2d911bc875497388d22b369ae488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Mon, 10 Jan 2022 21:55:40 -0300 Subject: [PATCH] Finish writing tests for ParseInputFunc() --- internal/structs/func_parser_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/structs/func_parser_test.go b/internal/structs/func_parser_test.go index 9fecd54..6227919 100644 --- a/internal/structs/func_parser_test.go +++ b/internal/structs/func_parser_test.go @@ -1,6 +1,7 @@ package structs_test import ( + "reflect" "testing" "github.com/vingarcia/ksql/internal/structs" @@ -14,7 +15,11 @@ type user struct { func TestParseInputFunc(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) { @@ -56,7 +61,7 @@ func TestParseInputFunc(t *testing.T) { }, { desc: "input function argument is not slice", - fn: func(users []string) error { + fn: func(users user) error { return nil }, expectErrToContain: []string{"ForEachChunk", "must a slice"},