mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
811 B
Swift
33 lines
811 B
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import SessionMessagingKit
|
|
|
|
// FIXME: Turn this into a protocol to make mocking possible
|
|
class TestInteraction: TSInteraction, Mockable {
|
|
// MARK: - Mockable
|
|
|
|
enum DataKey: Hashable {
|
|
case uniqueId
|
|
case timestamp
|
|
}
|
|
|
|
typealias Key = DataKey
|
|
|
|
var mockData: [DataKey: Any] = [:]
|
|
var didCallSave: Bool = false
|
|
|
|
// MARK: - TSInteraction
|
|
|
|
override var uniqueId: String? {
|
|
get { (mockData[.uniqueId] as? String) }
|
|
set { mockData[.uniqueId] = newValue }
|
|
}
|
|
|
|
override var timestamp: UInt64 {
|
|
(mockData[.timestamp] as! UInt64)
|
|
}
|
|
|
|
override func save(with transaction: YapDatabaseReadWriteTransaction) { didCallSave = true }
|
|
}
|