Skip to content

Commit 6c0137a

Browse files
authored
Merge pull request #15 from oracle-samples/soft_delete_join_test_fix
Fix TestCustomizeColumn with quoted identifiers and fix misleading TestJoinWithSoftDeleted test with correct checks.
2 parents e9cfdbc + 586a9e9 commit 6c0137a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tests/joins_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func TestJoinWithSoftDeleted(t *testing.T) {
259259

260260
var user1 User
261261
DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user1, user.ID)
262-
if user1.NamedPet == nil || user1.Account.ID == 0 {
262+
if user1.NamedPet.ID == 0 || user1.Account.ID == 0 {
263263
t.Fatalf("joins NamedPet and Account should not empty:%v", user1)
264264
}
265265

@@ -268,17 +268,17 @@ func TestJoinWithSoftDeleted(t *testing.T) {
268268

269269
var user2 User
270270
DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user2, user.ID)
271-
if user2.NamedPet == nil || user2.Account.ID != 0 {
272-
t.Fatalf("joins Account should not empty:%v", user2)
271+
if user2.NamedPet.ID == 0 || user2.Account.ID != 0 {
272+
t.Fatalf("joins Account should be empty:%v", user2)
273273
}
274274

275275
// NamedPet should empty
276276
DB.Delete(&user1.NamedPet)
277277

278278
var user3 User
279279
DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user3, user.ID)
280-
if user3.NamedPet != nil || user2.Account.ID != 0 {
281-
t.Fatalf("joins NamedPet and Account should not empty:%v", user2)
280+
if user3.NamedPet.ID != 0 || user3.Account.ID != 0 {
281+
t.Fatalf("joins NamedPet and Account should be empty:%v", user3)
282282
}
283283
}
284284

tests/passed-tests.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ TestCreateWithAutoIncrementCompositeKey
6868
TestCreateOnConflictWithDefaultNull
6969
TestCreateFromMapWithoutPK
7070
TestCreateFromMapWithTable
71-
#TestCustomizeColumn
71+
TestCustomizeColumn
7272
TestCustomColumnAndIgnoredFieldClash
7373
TestCustomizeField
7474
TestDefaultValue
@@ -142,7 +142,7 @@ TestJoinOn
142142
TestJoinsWithSelect
143143
TestJoinWithOmit
144144
TestJoinCount
145-
#TestJoinWithSoftDeleted
145+
TestJoinWithSoftDeleted
146146
TestInnerJoins
147147
TestJoinWithSameColumnName
148148
TestJoinArgsWithDB

0 commit comments

Comments
 (0)