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.
session-ios/SignalServiceKit/tests/Contacts/TSContactThreadTest.m

43 lines
1020 B
Objective-C

//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "MockSSKEnvironment.h"
#import "OWSIdentityManager.h"
#import "SSKBaseTestObjC.h"
#import "TSContactThread.h"
NS_ASSUME_NONNULL_BEGIN
@interface TSContactThreadTest : SSKBaseTestObjC
@property (nonatomic) TSContactThread *contactThread;
@end
@implementation TSContactThreadTest
- (void)setUp
{
[super setUp];
self.contactThread = [TSContactThread getOrCreateThreadWithContactId:@"fake-contact-id"];
[OWSRecipientIdentity removeAllObjectsInCollection];
}
- (void)testHasSafetyNumbersWithoutRemoteIdentity
{
XCTAssertFalse(self.contactThread.hasSafetyNumbers);
}
- (void)testHasSafetyNumbersWithRemoteIdentity
{
[[OWSIdentityManager sharedManager] saveRemoteIdentity:[[NSMutableData alloc] initWithLength:kStoredIdentityKeyLength]
recipientId:self.contactThread.contactIdentifier];
XCTAssert(self.contactThread.hasSafetyNumbers);
}
@end
NS_ASSUME_NONNULL_END