session-ios/SessionMessagingKitTests/_TestUtilities/TestTransaction.swift
Morgan Pretty f9c2655df4 Finalised the OpenGroupAPI and more tests
Fixed an issue where messages where signed incorrectly when blinding wasn't enabled on a SOGS
Fixed an issue where a single invalid message would result in all messages in that request being dropped
Updated the final legacy endpoint (ban and delete all messages)
Moved the OpenGroupManager poller values into the 'Cache' (so they are thread safe)
Started adding unit tests for the OpenGroupManager
Removed some redundant parameters from the 'Request' type
2022-03-15 15:19:23 +11:00

32 lines
846 B
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import Foundation
import YapDatabase
// FIXME: Turn this into a protocol to make mocking possible
final class TestTransaction: YapDatabaseReadWriteTransaction, Mockable {
// MARK: - Mockable
enum DataKey: Hashable {
case objectForKey
}
typealias Key = DataKey
var mockData: [DataKey: Any] = [:]
// MARK: - YapDatabaseReadWriteTransaction
override func object(forKey key: String, inCollection collection: String?) -> Any? {
return mockData[.objectForKey]
}
override func addCompletionQueue(_ completionQueue: DispatchQueue?, completionBlock: @escaping () -> Void) {
completionBlock()
}
}
extension TestTransaction: Mocked {
static var mockValue: TestTransaction = TestTransaction()
}