mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-24 23:16:52 +00:00
refactor: use reflect.TypeFor instead of reflect.TypeOf and improve related tests (#2101)
* refactor: using reflect.TypeFor Signed-off-by: suranmiao <solsui@outlook.com> * refactor: remove unused reflect.TypeFor calls and improve test assertions * refactor: simplify TestSetup by removing reflect.TypeFor * test: enhance test assertions and improve parallel execution in TestSetup --------- Signed-off-by: suranmiao <solsui@outlook.com> Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
@@ -1,18 +1,14 @@
|
||||
package loader
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetModuleMap(t *testing.T) {
|
||||
x := GetModuleMap()
|
||||
xType := reflect.TypeOf(x).String()
|
||||
if xType != "*tengo.ModuleMap" {
|
||||
t.Fatalf("GetModuleMap() should return pointer to ModuleMap instead received: %v", x)
|
||||
}
|
||||
|
||||
if x.Len() == 0 {
|
||||
t.Fatal("expected GetModuleMap() to contain module results instead received 0 value")
|
||||
}
|
||||
require.NotNil(t, x, "GetModuleMap must not return nil")
|
||||
assert.NotZero(t, x.Len(), "GetModuleMap should return a map with entries")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user