Skip to content

Commit 0c78d98

Browse files
extract mock identifiers to constants
1 parent d958095 commit 0c78d98

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

UnitTests/ObjCTests/MPRoktTests.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
#import "MParticleSwift.h"
99
#import "MPIConstants.h"
1010

11+
// Test constants for device identifiers
12+
static NSString * const kTestIDFA = @"ABC123-IDFA-TEST";
13+
static NSString * const kTestIDFV = @"ABC123-IDFV-TEST";
14+
1115
@interface MPRokt ()
1216
- (NSArray<NSDictionary<NSString *, NSString *> *> *)getRoktPlacementAttributesMapping;
1317
- (NSNumber *)getRoktHashedEmailUserIdentityType;
@@ -85,7 +89,7 @@ - (void)testSelectPlacementsSimpleWithValidParameters {
8589
MParticleUser *currentUser = self.sharedInstance.identity.currentUser;
8690

8791
// Set up IDFA and IDFV on the current user
88-
[self setIDFA:@"ABC123-IDFA-TEST" IDFV:@"ABC123-IDFV-TEST" forUser:currentUser];
92+
[self setIDFA:kTestIDFA IDFV:kTestIDFV forUser:currentUser];
8993

9094
[[[self.mockRokt stub] andReturn:@[]] getRoktPlacementAttributesMapping];
9195
MParticle *instance = self.sharedInstance;
@@ -108,7 +112,7 @@ - (void)testSelectPlacementsSimpleWithValidParameters {
108112

109113
// Set up test parameters
110114
NSString *identifier = @"testView";
111-
NSDictionary *attributes = @{@"email": @"[email protected]", @"idfa": @"ABC123-IDFA-TEST", @"idfv": @"ABC123-IDFV-TEST", @"sandbox": @"false"};
115+
NSDictionary *attributes = @{@"email": @"[email protected]", @"idfa": kTestIDFA, @"idfv": kTestIDFV, @"sandbox": @"false"};
112116

113117
// Set up expectations for kit container
114118
XCTestExpectation *expectation = [self expectationWithDescription:@"Wait for async operation"];
@@ -142,7 +146,7 @@ - (void)testSelectPlacementsExpandedWithValidParameters {
142146
MParticleUser *currentUser = self.sharedInstance.identity.currentUser;
143147

144148
// Set up IDFA and IDFV on the current user
145-
[self setIDFA:@"DEF456-IDFA-TEST" IDFV:@"DEF456-IDFV-TEST" forUser:currentUser];
149+
[self setIDFA:kTestIDFA IDFV:kTestIDFV forUser:currentUser];
146150

147151
[[[self.mockRokt stub] andReturn:@[]] getRoktPlacementAttributesMapping];
148152
MParticle *instance = self.sharedInstance;
@@ -166,7 +170,7 @@ - (void)testSelectPlacementsExpandedWithValidParameters {
166170
// Set up test parameters
167171
NSString *identifier = @"testView";
168172
NSDictionary *attributes = @{@"key": @"value"};
169-
NSDictionary *finalAttributes = @{@"key": @"value", @"idfa": @"DEF456-IDFA-TEST", @"idfv": @"DEF456-IDFV-TEST", @"sandbox": @"true"};
173+
NSDictionary *finalAttributes = @{@"key": @"value", @"idfa": kTestIDFA, @"idfv": kTestIDFV, @"sandbox": @"true"};
170174
MPRoktEmbeddedView *exampleView = [[MPRoktEmbeddedView alloc] initWithFrame:CGRectZero];
171175
NSDictionary *embeddedViews = @{@"placement": exampleView};
172176
MPRoktEventCallback *exampleCallbacks = [[MPRoktEventCallback alloc] init];
@@ -267,7 +271,7 @@ - (void)testSelectPlacementsSimpleWithMapping {
267271
MParticleUser *currentUser = self.sharedInstance.identity.currentUser;
268272

269273
// Set up IDFA and IDFV on the current user
270-
[self setIDFA:@"C56A4180-65AA-42EC-A945-5FD21DEC0538" IDFV:@"C56A4180-65AA-42EC-A945-5FD21DEC0539" forUser:currentUser];
274+
[self setIDFA:kTestIDFA IDFV:kTestIDFV forUser:currentUser];
271275

272276
[[[self.mockRokt stub] andReturn:@[@{@"map": @"f.name", @"maptype": @"UserAttributeClass.Name", @"value": @"firstname"}, @{@"map": @"zip", @"maptype": @"UserAttributeClass.Name", @"value": @"billingzipcode"}, @{@"map": @"l.name", @"maptype": @"UserAttributeClass.Name", @"value": @"lastname"}]] getRoktPlacementAttributesMapping];
273277
MParticle *instance = self.sharedInstance;
@@ -291,7 +295,7 @@ - (void)testSelectPlacementsSimpleWithMapping {
291295
// Set up test parameters
292296
NSString *identifier = @"testView";
293297
NSDictionary *attributes = @{@"f.name": @"Brandon"};
294-
NSDictionary *mappedAttributes = @{@"firstname": @"Brandon", @"idfa": @"C56A4180-65AA-42EC-A945-5FD21DEC0538", @"idfv": @"C56A4180-65AA-42EC-A945-5FD21DEC0539", @"sandbox": @"true"};
298+
NSDictionary *mappedAttributes = @{@"firstname": @"Brandon", @"idfa": kTestIDFA, @"idfv": kTestIDFV, @"sandbox": @"true"};
295299

296300
// Set up expectations for kit container
297301
XCTestExpectation *expectation = [self expectationWithDescription:@"Wait for async operation"];

0 commit comments

Comments
 (0)