From ab2debc29a1ad42fc4fcb5fb22b39619d85cf1d4 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Mon, 25 Nov 2024 12:15:12 +1100 Subject: [PATCH] Missed a change and fixed broken tests --- .../Jobs/ProcessPendingGroupMemberRemovalsJob.swift | 5 +++-- .../LibSession/LibSessionGroupInfoSpec.swift | 1 + .../_TestUtilities/MockLibSessionCache.swift | 4 ++++ _SharedTestUtilities/MockJobRunner.swift | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/SessionMessagingKit/Jobs/ProcessPendingGroupMemberRemovalsJob.swift b/SessionMessagingKit/Jobs/ProcessPendingGroupMemberRemovalsJob.swift index f99251377..574a985ef 100644 --- a/SessionMessagingKit/Jobs/ProcessPendingGroupMemberRemovalsJob.swift +++ b/SessionMessagingKit/Jobs/ProcessPendingGroupMemberRemovalsJob.swift @@ -3,6 +3,7 @@ import Foundation import Combine import GRDB +import SessionUtil import SessionUIKit import SessionUtilitiesKit import SessionSnodeKit @@ -68,7 +69,7 @@ public enum ProcessPendingGroupMemberRemovalsJob: JobExecutor { /// If there are no pending removals then we can just complete guard - let pendingRemovals: [String: Bool] = try? LibSession.getPendingMemberRemovals( + let pendingRemovals: [String: GROUP_MEMBER_STATUS] = try? LibSession.getPendingMemberRemovals( groupSessionId: groupSessionId, using: dependencies ), @@ -87,7 +88,7 @@ public enum ProcessPendingGroupMemberRemovalsJob: JobExecutor { ) let messageSendTimestamp: Int64 = dependencies[cache: .snodeAPI].currentOffsetTimestampMs() let memberIdsToRemoveContent: Set = pendingRemovals - .filter { _, shouldRemoveContent -> Bool in shouldRemoveContent } + .filter { _, status -> Bool in status == GROUP_MEMBER_STATUS_REMOVED_MEMBER_AND_MESSAGES } .map { memberId, _ -> String in memberId } .asSet() diff --git a/SessionMessagingKitTests/LibSession/LibSessionGroupInfoSpec.swift b/SessionMessagingKitTests/LibSession/LibSessionGroupInfoSpec.swift index 5b0c2917a..36ba95aee 100644 --- a/SessionMessagingKitTests/LibSession/LibSessionGroupInfoSpec.swift +++ b/SessionMessagingKitTests/LibSession/LibSessionGroupInfoSpec.swift @@ -90,6 +90,7 @@ class LibSessionGroupInfoSpec: QuickSpec { .thenReturn(createGroupOutput.groupState[.groupKeys]) cache.when { $0.configNeedsDump(.any) }.thenReturn(true) cache.when { try $0.createDump(config: .any, for: .any, sessionId: .any, timestampMs: .any) }.thenReturn(nil) + cache.when { try $0.performAndPushChange(.any, for: .any, sessionId: .any, change: { _ in }) }.thenReturn(nil) } ) diff --git a/SessionMessagingKitTests/_TestUtilities/MockLibSessionCache.swift b/SessionMessagingKitTests/_TestUtilities/MockLibSessionCache.swift index 19b89cdf4..250bf4e86 100644 --- a/SessionMessagingKitTests/_TestUtilities/MockLibSessionCache.swift +++ b/SessionMessagingKitTests/_TestUtilities/MockLibSessionCache.swift @@ -24,6 +24,10 @@ class MockLibSessionCache: Mock, LibSessionCacheType { mockNoReturn(args: [userConfigVariants, groups, userSessionId, userEd25519KeyPair]) } + func hasConfig(for variant: ConfigDump.Variant, sessionId: SessionId) -> Bool { + return mock(args: [variant, sessionId]) + } + func config(for variant: ConfigDump.Variant, sessionId: SessionId) -> LibSession.Config? { return mock(args: [variant, sessionId]) } diff --git a/_SharedTestUtilities/MockJobRunner.swift b/_SharedTestUtilities/MockJobRunner.swift index b3fa21e8e..503b8c843 100644 --- a/_SharedTestUtilities/MockJobRunner.swift +++ b/_SharedTestUtilities/MockJobRunner.swift @@ -28,6 +28,10 @@ class MockJobRunner: Mock, JobRunnerType { return mock(args: [jobs, state, variant]) } + func deferCount(for jobId: Int64?, of variant: Job.Variant) -> Int { + return mock(args: [jobId, variant]) + } + func appDidFinishLaunching() {} func appDidBecomeActive() {} func startNonBlockingQueues() {}