44#import < mParticle_Rokt/mParticle_Rokt.h>
55#import " MPKitRokt.h"
66
7+ NSInteger const kMPRoktKitCode = 181 ;
8+ NSString * const kMPHashedEmailUserIdentityType = @" hashedEmailUserIdentityType" ;
9+
710@interface MPKitRokt ()
811
912- (MPKitExecStatus *)executeWithIdentifier : (NSString * _Nullable)identifier
@@ -24,6 +27,8 @@ + (void)addIdentityAttributes:(NSMutableDictionary<NSString *, NSString *> * _Nu
2427
2528+ (void )handleHashedEmail : (NSMutableDictionary <NSString *, NSString *> * _Nullable)attributes ;
2629
30+ + (NSDictionary *)getKitConfig ;
31+
2732+ (NSNumber *)getRoktHashedEmailUserIdentityType ;
2833
2934+ (RoktConfig *)convertMPRoktConfig : (MPRoktConfig *)mpRoktConfig ;
@@ -677,4 +682,49 @@ - (void)testTransformValuesToString {
677682 XCTAssertTrue (finalAtt.allKeys .count == 4 );
678683}
679684
685+ - (void )testGetRoktHashedEmailUserIdentityTypeOther4 {
686+ // Test case 1: When kit configuration exists with hashed email identity type
687+ NSDictionary *roktKitConfig = @{
688+ @" id" : @(kMPRoktKitCode ),
689+ kMPHashedEmailUserIdentityType : @" other4"
690+ };
691+
692+ // Mock the MParticle shared instance and kit container
693+ id mockMPKitRoktClass = OCMClassMock ([MPKitRokt class ]);
694+ [[[mockMPKitRoktClass stub ] andReturn: roktKitConfig] getKitConfig ];
695+
696+ // Call the method and verify result
697+ NSNumber *result = [MPKitRokt getRoktHashedEmailUserIdentityType ];
698+ XCTAssertEqualObjects (result, @(MPIdentityOther4), @" Should return MPIdentityOther4 when configured with 'other4'" );
699+
700+ [mockMPKitRoktClass stopMocking ];
701+ }
702+
703+ - (void )testGetRoktHashedEmailUserIdentityTypeConfigNil {
704+ // Test case 2: When kit config nil
705+ // Mock the MParticle shared instance and kit container
706+ id mockMPKitRoktClass = OCMClassMock ([MPKitRokt class ]);
707+ [[[mockMPKitRoktClass stub ] andReturn: nil ] getKitConfig ];
708+
709+ NSNumber *defaultResult = [MPKitRokt getRoktHashedEmailUserIdentityType ];
710+ XCTAssertNil (defaultResult, @" Should return nil when when no configuration exists" );
711+
712+ [mockMPKitRoktClass stopMocking ];
713+ }
714+
715+ - (void )testGetRoktHashedEmailUserIdentityTypeNil {
716+ // Mock the MParticle shared instance and kit container
717+ id mockMPKitRoktClass = OCMClassMock ([MPKitRokt class ]);
718+ // Test case 3: When kit config exists but no hashed email identity type specified
719+ NSDictionary *roktKitConfigNoHash = @{
720+ @" id" : @(kMPRoktKitCode )
721+ };
722+ [[[mockMPKitRoktClass stub ] andReturn: roktKitConfigNoHash] getKitConfig ];
723+
724+ NSNumber *noHashResult = [MPKitRokt getRoktHashedEmailUserIdentityType ];
725+ XCTAssertNil (noHashResult, @" Should return nil when hashed email identity type not specified" );
726+
727+ [mockMPKitRoktClass stopMocking ];
728+ }
729+
680730@end
0 commit comments