Skip to content

Commit 7cd1778

Browse files
Fixed tests
1 parent e195ff2 commit 7cd1778

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

tests/preload_test.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import (
5757
)
5858

5959
func TestPreloadWithAssociations(t *testing.T) {
60-
t.Skip()
6160
user := *GetUser("preload_with_associations", Config{
6261
Account: true,
6362
Pets: 2,
@@ -95,7 +94,6 @@ func TestPreloadWithAssociations(t *testing.T) {
9594
}
9695

9796
func TestNestedPreload(t *testing.T) {
98-
t.Skip()
9997
user := *GetUser("nested_preload", Config{Pets: 2})
10098

10199
for idx, pet := range user.Pets {
@@ -209,7 +207,6 @@ func TestPreloadWithConds(t *testing.T) {
209207
}
210208

211209
func TestNestedPreloadWithConds(t *testing.T) {
212-
t.Skip()
213210
users := []User{
214211
*GetUser("slice_nested_preload_1", Config{Pets: 2}),
215212
*GetUser("slice_nested_preload_2", Config{Pets: 0}),
@@ -300,7 +297,6 @@ func TestPreloadGoroutine(t *testing.T) {
300297
}
301298

302299
func TestPreloadWithDiffModel(t *testing.T) {
303-
t.Skip()
304300
user := *GetUser("preload_with_diff_model", Config{Account: true})
305301

306302
if err := DB.Create(&user).Error; err != nil {
@@ -319,7 +315,6 @@ func TestPreloadWithDiffModel(t *testing.T) {
319315
}
320316

321317
func TestNestedPreloadWithUnscoped(t *testing.T) {
322-
t.Skip()
323318
user := *GetUser("nested_preload", Config{Pets: 1})
324319
pet := user.Pets[0]
325320
pet.Toy = Toy{Name: "toy_nested_preload_" + strconv.Itoa(1)}
@@ -434,7 +429,6 @@ func TestNestedPreloadWithNestedJoin(t *testing.T) {
434429
}
435430

436431
func TestMergeNestedPreloadWithNestedJoin(t *testing.T) {
437-
t.Skip()
438432
users := []User{
439433
{
440434
Name: "TestMergeNestedPreloadWithNestedJoin-1",
@@ -473,7 +467,7 @@ func TestMergeNestedPreloadWithNestedJoin(t *testing.T) {
473467
err := sess.
474468
Joins("Manager").
475469
Preload("Manager.Tools").
476-
Where("users.name Like ?", "TestMergeNestedPreloadWithNestedJoin%").
470+
Where("\"users\".\"name\" Like ?", "TestMergeNestedPreloadWithNestedJoin%").
477471
Find(&result).Error
478472

479473
if err != nil {
@@ -541,7 +535,6 @@ func TestNestedPreloadWithPointerJoin(t *testing.T) {
541535
}
542536

543537
func TestEmbedPreload(t *testing.T) {
544-
t.Skip()
545538
type Country struct {
546539
ID int `gorm:"primaryKey"`
547540
Name string
@@ -666,7 +659,7 @@ func TestEmbedPreload(t *testing.T) {
666659
for _, test := range testList {
667660
t.Run(test.name, func(t *testing.T) {
668661
actual := Org{}
669-
tx := DB.Where("id = ?", org.ID).Session(&gorm.Session{})
662+
tx := DB.Where("\"id\" = ?", org.ID).Session(&gorm.Session{})
670663
for name, args := range test.preloads {
671664
tx = tx.Preload(name, args...)
672665
}

0 commit comments

Comments
 (0)