From d4f78db1894699487523553414b73f2a8a9e3484 Mon Sep 17 00:00:00 2001 From: khalil Date: Thu, 28 Mar 2024 22:51:33 +0330 Subject: [PATCH] :white_check_mark: add prettier file test --- prettier_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 prettier_test.go diff --git a/prettier_test.go b/prettier_test.go new file mode 100644 index 0000000..ae0ea41 --- /dev/null +++ b/prettier_test.go @@ -0,0 +1,32 @@ +package main + +import ( + "reflect" + "testing" +) + +type MockData struct { + Name string + Age int +} + +func TestMakeTable(t *testing.T) { + data := []interface{}{ + MockData{Name: "John", Age: 30}, + MockData{Name: "Doe", Age: 40}, + } + + makeTable(data) +} + +func TestToSlice(t *testing.T) { + a := []MockData{ + {Name: "John", Age: 30}, + {Name: "Doe", Age: 40}, + } + + result := toSlice(a) + if reflect.TypeOf(result).Kind() != reflect.Slice { + t.Errorf("Expected Slice got %v", reflect.TypeOf(result).Kind()) + } +}