Signal-iOS/SignalServiceKit/tests/Contacts/TSContactThreadTest.swift
Harry a146e18aaf
Set up account state and exit registration
* Go to chat list view after registration

* sync system contacts during registration

* Use explicit local credentials for storage service operations during registration

* fix tests

* Quick hack to get through double pin confirmation

* Finishing touches

* lint

* fix build

* reload phone number discoverability after storage service sync

* fix tests again

* Take chat auth on account and contact record initializers

* Change around branches for clarity in OWSUserProfile

* pr comments

* Split ChatServiceAuth into the same and AuthedAccount

* fix tests

* merge woes
2023-03-09 21:54:51 -08:00

38 lines
1.1 KiB
Swift

//
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
import XCTest
import SignalServiceKit
class TSContactThreadTest: SSKBaseTestSwift {
private func contactThread() -> TSContactThread {
TSContactThread.getOrCreateThread(contactAddress: SignalServiceAddress(phoneNumber: "+12225550123"))
}
override func setUp() {
super.setUp()
tsAccountManager.registerForTests(withLocalNumber: "+13335550123", uuid: UUID())
}
func testHasSafetyNumbersWithoutRemoteIdentity() {
XCTAssertFalse(contactThread().hasSafetyNumbers())
}
func testHasSafetyNumbersWithRemoteIdentity() {
let contactThread = self.contactThread()
OWSIdentityManager.shared.saveRemoteIdentity(
Data(count: Int(kStoredIdentityKeyLength)),
address: contactThread.contactAddress,
authedAccount: .implicit()
)
XCTAssert(contactThread.hasSafetyNumbers())
}
func testCanSendChatMessagesToThread() {
XCTAssertTrue(contactThread().canSendChatMessagesToThread())
}
}