Skip to content

Commit 3d73755

Browse files
committed
fix DeleteAllDataCleanSlateTests
1 parent 119d8f2 commit 3d73755

1 file changed

Lines changed: 38 additions & 6 deletions

File tree

ConvosCore/Tests/ConvosCoreTests/DeleteAllDataCleanSlateTests.swift

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ struct DeleteAllDataCleanSlateTests {
1818
let dbManager = MockDatabaseManager.makeTestDatabase()
1919

2020
try await dbManager.dbWriter.write { db in
21+
try DBMember(inboxId: "me").save(db, onConflict: .ignore)
22+
try DBConversation(
23+
id: "c1",
24+
clientConversationId: "c1",
25+
inviteTag: "tag-c1",
26+
creatorId: "me",
27+
kind: .group,
28+
consent: .allowed,
29+
createdAt: Date(),
30+
name: nil,
31+
description: nil,
32+
imageURLString: nil,
33+
publicImageURLString: nil,
34+
includeInfoInPublicPreview: true,
35+
expiresAt: nil,
36+
debugInfo: .empty,
37+
isLocked: false,
38+
imageSalt: nil,
39+
imageNonce: nil,
40+
imageEncryptionKey: nil,
41+
conversationEmoji: nil,
42+
imageLastRenewed: nil,
43+
isUnused: false,
44+
hasHadVerifiedAgent: false
45+
).insert(db)
2146
try DBMyProfile(inboxId: "me", name: "Me").save(db)
2247
try DBProfile(
2348
inboxId: "alice", name: "Alice", profileSource: .profileUpdate,
@@ -42,12 +67,19 @@ struct DeleteAllDataCleanSlateTests {
4267
try SessionManager.wipeAccountScopedRows(db)
4368
}
4469

45-
try await dbManager.dbWriter.read { db in
46-
#expect(try DBMyProfile.fetchCount(db) == 0)
47-
#expect(try DBProfile.fetchCount(db) == 0)
48-
#expect(try DBProfileAvatar.fetchCount(db) == 0)
49-
#expect(try DBProfileAvatarSource.fetchCount(db) == 0)
50-
#expect(try DBProfilePublishJob.fetchCount(db) == 0)
70+
let counts = try await dbManager.dbWriter.read { db in
71+
(
72+
myProfile: try DBMyProfile.fetchCount(db),
73+
profile: try DBProfile.fetchCount(db),
74+
avatar: try DBProfileAvatar.fetchCount(db),
75+
avatarSource: try DBProfileAvatarSource.fetchCount(db),
76+
publishJob: try DBProfilePublishJob.fetchCount(db)
77+
)
5178
}
79+
#expect(counts.myProfile == 0)
80+
#expect(counts.profile == 0)
81+
#expect(counts.avatar == 0)
82+
#expect(counts.avatarSource == 0)
83+
#expect(counts.publishJob == 0)
5284
}
5385
}

0 commit comments

Comments
 (0)