diff --git a/Sources/XXMessengerClient/Utils/BackupParams.swift b/Sources/XXMessengerClient/Utils/BackupParams.swift index c3bd8fc0f8e566348bb1d731bf8606c2f8bea5ce..8bf39a5189049f234ec9ab991c63ecdf59b0f1ce 100644 --- a/Sources/XXMessengerClient/Utils/BackupParams.swift +++ b/Sources/XXMessengerClient/Utils/BackupParams.swift @@ -2,18 +2,12 @@ import Foundation public struct BackupParams: Equatable { public init( - username: String, - email: String?, - phone: String? + username: String ) { self.username = username - self.email = email - self.phone = phone } public var username: String - public var email: String? - public var phone: String? } extension BackupParams: Codable { diff --git a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerBackupParamsTests.swift b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerBackupParamsTests.swift index e0af7129f1f82f9c5fbce7b67d2ea4c3ff05060e..b65a34b9fbac97ab2a3fc629a7bce09552ae39b1 100644 --- a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerBackupParamsTests.swift +++ b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerBackupParamsTests.swift @@ -15,16 +15,11 @@ final class MessengerBackupParamsTests: XCTestCase { return backup } let backup: MessengerBackupParams = .live(env) - let params = BackupParams( - username: "test-username", - email: "test-email", - phone: "test-phone" - ) - try backup(params) + try backup(.stub) XCTAssertNoDifference(didAddJSON, [ - String(data: try params.encode(), encoding: .utf8)! + String(data: try BackupParams.stub.encode(), encoding: .utf8)! ]) } @@ -32,9 +27,8 @@ final class MessengerBackupParamsTests: XCTestCase { var env: MessengerEnvironment = .unimplemented env.backup.get = { nil } let backup: MessengerBackupParams = .live(env) - let params = BackupParams(username: "test", email: nil, phone: nil) - XCTAssertThrowsError(try backup(params)) { error in + XCTAssertThrowsError(try backup(.stub)) { error in XCTAssertNoDifference( error as NSError, MessengerBackupParams.Error.notRunning as NSError @@ -50,9 +44,8 @@ final class MessengerBackupParamsTests: XCTestCase { return backup } let backup: MessengerBackupParams = .live(env) - let params = BackupParams(username: "test", email: nil, phone: nil) - XCTAssertThrowsError(try backup(params)) { error in + XCTAssertThrowsError(try backup(.stub)) { error in XCTAssertNoDifference( error as NSError, MessengerBackupParams.Error.notRunning as NSError diff --git a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerRestoreBackupTests.swift b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerRestoreBackupTests.swift index 67663feebde5554f9810dc36260bd2055c15a66f..672adc37550225bdab6a9ea7953c2b5a0b86b248 100644 --- a/Tests/XXMessengerClientTests/Messenger/Functions/MessengerRestoreBackupTests.swift +++ b/Tests/XXMessengerClientTests/Messenger/Functions/MessengerRestoreBackupTests.swift @@ -10,11 +10,7 @@ final class MessengerRestoreBackupTests: XCTestCase { let ndfData = "ndf-data".data(using: .utf8)! let password = "password".data(using: .utf8)! let backupContacts: [Data] = (1...3).map { "contact-\($0)" }.map { $0.data(using: .utf8)! } - let backupParams = BackupParams( - username: "backup-username", - email: "backup-email", - phone: "backup-phone" - ) + let backupParams = BackupParams.stub let backupReport = BackupReport( restoredContacts: backupContacts, params: String(data: try! JSONEncoder().encode(backupParams), encoding: .utf8)! diff --git a/Tests/XXMessengerClientTests/TestHelpers/TestDoubles.swift b/Tests/XXMessengerClientTests/TestHelpers/TestDoubles.swift index 4d57e29363d3f22bdbb836622d7bfa92b014b683..c9a90bde352a9da4ac0c359c26fed8e1a89d9f8f 100644 --- a/Tests/XXMessengerClientTests/TestHelpers/TestDoubles.swift +++ b/Tests/XXMessengerClientTests/TestHelpers/TestDoubles.swift @@ -20,8 +20,6 @@ extension Message { extension BackupParams { static let stub = BackupParams( - username: "stub-username", - email: "stub-email", - phone: "stub-phone" + username: "stub-username" ) }