add table on TestCreateWithInterfaceArrayTypeWithTable

This commit is contained in:
KEHyeon 2025-02-15 16:56:29 +09:00
parent 47ae801b4c
commit 0dbcd1cd36

View File

@ -823,12 +823,12 @@ func TestCreateWithInterfaceType(t *testing.T) {
} }
} }
func TestCreateWithInterfaceArrayType(t *testing.T) { func TestCreateWithInterfaceArrayTypeWithTable(t *testing.T) {
user := *GetUser("create", Config{}) user := *GetUser("create", Config{})
type UserInterface interface{} type UserInterface interface{}
var userInterface UserInterface = &user var userInterface UserInterface = &user
if results := DB.Create([]UserInterface{userInterface}); results.Error != nil { if results := DB.Table("users").Create([]UserInterface{userInterface}); results.Error != nil {
t.Fatalf("errors happened when create: %v", results.Error) t.Fatalf("errors happened when create: %v", results.Error)
} else if results.RowsAffected != 1 { } else if results.RowsAffected != 1 {
t.Fatalf("rows affected expects: %v, got %v", 1, results.RowsAffected) t.Fatalf("rows affected expects: %v, got %v", 1, results.RowsAffected)