Skip to content

Commit 2a38817

Browse files
committed
Add unit tests
1 parent 2a6e164 commit 2a38817

6 files changed

Lines changed: 225 additions & 46 deletions

File tree

mParticle-Rokt.xcodeproj/project.pbxproj

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
/* Begin PBXBuildFile section */
1010
2502325C2D7A7BF3004794A2 /* Rokt-Widget in Frameworks */ = {isa = PBXBuildFile; productRef = 2502325B2D7A7BF3004794A2 /* Rokt-Widget */; };
11-
536803952B7BAE11000A10BE /* mParticle-Apple-SDK in Frameworks */ = {isa = PBXBuildFile; productRef = 536803942B7BAE11000A10BE /* mParticle-Apple-SDK */; };
1211
7E15B2092D9AE82000C1FF3E /* mParticle-Apple-SDK in Frameworks */ = {isa = PBXBuildFile; productRef = 7E15B2082D9AE82000C1FF3E /* mParticle-Apple-SDK */; };
1312
7E15B20B2D9AE82600C1FF3E /* Rokt-Widget in Frameworks */ = {isa = PBXBuildFile; productRef = 7E15B20A2D9AE82600C1FF3E /* Rokt-Widget */; };
1413
7EE7F13E2DA95BEE006C5440 /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 7EE7F13D2DA95BEE006C5440 /* OCMock */; };
14+
B34CE5592E04320900712DE1 /* mParticle-Apple-SDK in Frameworks */ = {isa = PBXBuildFile; productRef = B34CE5582E04320900712DE1 /* mParticle-Apple-SDK */; };
15+
B34CE55A2E04356F00712DE1 /* MPRoktEventMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */; };
1516
B3D778532E02845700D887A4 /* MPRoktEventMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */; };
16-
B3D778582E028ACD00D887A4 /* MPRoktEventMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */; };
1717
DBB01A601DC1478A00A7B188 /* mParticle_Rokt.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A5E1DC1478A00A7B188 /* mParticle_Rokt.h */; settings = {ATTRIBUTES = (Public, ); }; };
1818
DBB01A681DC1480700A7B188 /* MPKitRokt.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A661DC1480700A7B188 /* MPKitRokt.h */; };
1919
DBB01A691DC1480700A7B188 /* MPKitRokt.m in Sources */ = {isa = PBXBuildFile; fileRef = DBB01A671DC1480700A7B188 /* MPKitRokt.m */; };
@@ -33,7 +33,6 @@
3333

3434
/* Begin PBXFileReference section */
3535
B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPRoktEventMapper.swift; sourceTree = "<group>"; };
36-
B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPRoktEventMapper.h; sourceTree = "<group>"; };
3736
DBB01A5B1DC1478A00A7B188 /* mParticle_Rokt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mParticle_Rokt.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3837
DBB01A5E1DC1478A00A7B188 /* mParticle_Rokt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mParticle_Rokt.h; sourceTree = "<group>"; };
3938
DBB01A5F1DC1478A00A7B188 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -49,8 +48,8 @@
4948
isa = PBXFrameworksBuildPhase;
5049
buildActionMask = 2147483647;
5150
files = (
51+
B34CE5592E04320900712DE1 /* mParticle-Apple-SDK in Frameworks */,
5252
2502325C2D7A7BF3004794A2 /* Rokt-Widget in Frameworks */,
53-
536803952B7BAE11000A10BE /* mParticle-Apple-SDK in Frameworks */,
5453
);
5554
runOnlyForDeploymentPostprocessing = 0;
5655
};
@@ -90,7 +89,6 @@
9089
DBB01A5D1DC1478A00A7B188 /* mParticle-Rokt */ = {
9190
isa = PBXGroup;
9291
children = (
93-
B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */,
9492
B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */,
9593
DBB01A661DC1480700A7B188 /* MPKitRokt.h */,
9694
DBB01A671DC1480700A7B188 /* MPKitRokt.m */,
@@ -123,7 +121,6 @@
123121
isa = PBXHeadersBuildPhase;
124122
buildActionMask = 2147483647;
125123
files = (
126-
B3D778582E028ACD00D887A4 /* MPRoktEventMapper.h in Headers */,
127124
DBB01A601DC1478A00A7B188 /* mParticle_Rokt.h in Headers */,
128125
DBB01A681DC1480700A7B188 /* MPKitRokt.h in Headers */,
129126
);
@@ -147,8 +144,8 @@
147144
);
148145
name = "mParticle-Rokt";
149146
packageProductDependencies = (
150-
536803942B7BAE11000A10BE /* mParticle-Apple-SDK */,
151147
2502325B2D7A7BF3004794A2 /* Rokt-Widget */,
148+
B34CE5582E04320900712DE1 /* mParticle-Apple-SDK */,
152149
);
153150
productName = "mParticle-Rokt";
154151
productReference = DBB01A5B1DC1478A00A7B188 /* mParticle_Rokt.framework */;
@@ -203,9 +200,9 @@
203200
);
204201
mainGroup = DBB01A511DC1478A00A7B188;
205202
packageReferences = (
206-
536803932B7BAE11000A10BE /* XCRemoteSwiftPackageReference "mparticle-apple-sdk" */,
207203
2502325A2D7A7BF3004794A2 /* XCRemoteSwiftPackageReference "rokt-sdk-ios" */,
208204
7EE7F13C2DA95BEE006C5440 /* XCRemoteSwiftPackageReference "ocmock" */,
205+
B34CE5572E04320900712DE1 /* XCLocalSwiftPackageReference "../mparticle-apple-sdk" */,
209206
);
210207
productRefGroup = DBB01A5C1DC1478A00A7B188 /* Products */;
211208
projectDirPath = "";
@@ -239,7 +236,7 @@
239236
isa = PBXSourcesBuildPhase;
240237
buildActionMask = 2147483647;
241238
files = (
242-
B3D778522E02845700D887A4 /* MPRoktEventMapper.swift in Sources */,
239+
B34CE55A2E04356F00712DE1 /* MPRoktEventMapper.swift in Sources */,
243240
DBB01A691DC1480700A7B188 /* MPKitRokt.m in Sources */,
244241
);
245242
runOnlyForDeploymentPostprocessing = 0;
@@ -289,6 +286,7 @@
289286
COPY_PHASE_STRIP = NO;
290287
CURRENT_PROJECT_VERSION = 1;
291288
DEBUG_INFORMATION_FORMAT = dwarf;
289+
DEFINES_MODULE = YES;
292290
ENABLE_STRICT_OBJC_MSGSEND = YES;
293291
ENABLE_TESTABILITY = YES;
294292
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -340,6 +338,7 @@
340338
COPY_PHASE_STRIP = NO;
341339
CURRENT_PROJECT_VERSION = 1;
342340
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
341+
DEFINES_MODULE = YES;
343342
ENABLE_NS_ASSERTIONS = NO;
344343
ENABLE_STRICT_OBJC_MSGSEND = YES;
345344
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -527,6 +526,13 @@
527526
};
528527
/* End XCConfigurationList section */
529528

529+
/* Begin XCLocalSwiftPackageReference section */
530+
B34CE5572E04320900712DE1 /* XCLocalSwiftPackageReference "../mparticle-apple-sdk" */ = {
531+
isa = XCLocalSwiftPackageReference;
532+
relativePath = "../mparticle-apple-sdk";
533+
};
534+
/* End XCLocalSwiftPackageReference section */
535+
530536
/* Begin XCRemoteSwiftPackageReference section */
531537
2502325A2D7A7BF3004794A2 /* XCRemoteSwiftPackageReference "rokt-sdk-ios" */ = {
532538
isa = XCRemoteSwiftPackageReference;
@@ -560,11 +566,6 @@
560566
package = 2502325A2D7A7BF3004794A2 /* XCRemoteSwiftPackageReference "rokt-sdk-ios" */;
561567
productName = "Rokt-Widget";
562568
};
563-
536803942B7BAE11000A10BE /* mParticle-Apple-SDK */ = {
564-
isa = XCSwiftPackageProductDependency;
565-
package = 536803932B7BAE11000A10BE /* XCRemoteSwiftPackageReference "mparticle-apple-sdk" */;
566-
productName = "mParticle-Apple-SDK";
567-
};
568569
7E15B2082D9AE82000C1FF3E /* mParticle-Apple-SDK */ = {
569570
isa = XCSwiftPackageProductDependency;
570571
package = 536803932B7BAE11000A10BE /* XCRemoteSwiftPackageReference "mparticle-apple-sdk" */;
@@ -580,6 +581,10 @@
580581
package = 7EE7F13C2DA95BEE006C5440 /* XCRemoteSwiftPackageReference "ocmock" */;
581582
productName = OCMock;
582583
};
584+
B34CE5582E04320900712DE1 /* mParticle-Apple-SDK */ = {
585+
isa = XCSwiftPackageProductDependency;
586+
productName = "mParticle-Apple-SDK";
587+
};
583588
/* End XCSwiftPackageProductDependency section */
584589
};
585590
rootObject = DBB01A521DC1478A00A7B188 /* Project object */;

mParticle-Rokt/MPKitRokt.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import "MPKitRokt.h"
22
#import <Rokt_Widget/Rokt_Widget-Swift.h>
3-
#import "MPRoktEventMapper.h"
3+
#import <mParticle_Rokt/mParticle_Rokt-Swift.h>
44

55
NSString * const kMPRemoteConfigKitHashesKey = @"hs";
66
NSString * const kMPRemoteConfigUserAttributeFilter = @"ua";
@@ -154,10 +154,10 @@ - (RoktFrameworkType)mapMPWrapperSdkToRoktFrameworkType:(MPWrapperSdk)wrapperSdk
154154

155155
- (NSDictionary<NSString *, RoktEmbeddedView *> * _Nullable) confirmEmbeddedViews:(NSDictionary<NSString *, MPRoktEmbeddedView *> * _Nullable)embeddedViews {
156156
NSMutableDictionary <NSString *, RoktEmbeddedView *> *safePlacements = [NSMutableDictionary dictionary];
157-
157+
158158
for (NSString* key in embeddedViews) {
159159
MPRoktEmbeddedView *mpView = [embeddedViews objectForKey:key];
160-
160+
161161
if ([mpView isKindOfClass:MPRoktEmbeddedView.class]) {
162162
// Create a new RoktEmbeddedView instance
163163
RoktEmbeddedView *roktView = [[RoktEmbeddedView alloc] initWithFrame:mpView.bounds];
@@ -167,7 +167,7 @@ - (RoktFrameworkType)mapMPWrapperSdkToRoktFrameworkType:(MPWrapperSdk)wrapperSdk
167167
[safePlacements setObject:roktView forKey:key];
168168
}
169169
}
170-
170+
171171
return safePlacements;
172172
}
173173

@@ -297,7 +297,7 @@ - (MPKitExecStatus *)purchaseFinalized:(NSString *)placementId catalogItemId:(NS
297297
return [[MPKitExecStatus alloc] initWithSDKCode:[[self class] kitCode] returnCode:MPKitReturnCodeFail];
298298
}
299299

300-
- (MPKitExecStatus *)eventsWithIdentifier:(NSString *)identifier onEvent:(void (^)(MPRoktEvent * _Nonnull))onEvent {
300+
- (MPKitExecStatus *)events:(NSString *)identifier onEvent:(void (^)(MPRoktEvent * _Nonnull))onEvent {
301301
[Rokt eventsWithViewName:identifier onEvent:^(RoktEvent * _Nonnull event) {
302302
MPRoktEvent *mpEvent = [MPRoktEventMapper mapEvent:event];
303303
if (mpEvent) {
@@ -307,7 +307,7 @@ - (MPKitExecStatus *)eventsWithIdentifier:(NSString *)identifier onEvent:(void (
307307
return [[MPKitExecStatus alloc] initWithSDKCode:[[self class] kitCode] returnCode:MPKitReturnCodeSuccess];
308308
}
309309

310-
- (MPKitExecStatus *)globalEventsOnEvent:(void (^)(MPRoktEvent * _Nonnull))onEvent {
310+
- (MPKitExecStatus *)globalEvents:(void (^)(MPRoktEvent * _Nonnull))onEvent {
311311
[Rokt globalEventsOnEvent:^(RoktEvent * _Nonnull event) {
312312
MPRoktEvent *mpEvent = [MPRoktEventMapper mapEvent:event];
313313
if (mpEvent) {

mParticle-Rokt/MPRoktEventMapper.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

mParticle-Rokt/MPRoktEventMapper.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ import mParticle_Apple_SDK
33
import Rokt_Widget
44

55
/// Utility class for mapping Rokt events to mParticle events
6-
@objc(MPRoktEventMapper) public class MPRoktEventMapper: NSObject {
6+
@objc(MPRoktEventMapper)
7+
@objcMembers
8+
public class MPRoktEventMapper: NSObject {
9+
710
/// Maps a RoktEvent to the corresponding MPRoktEvent
811
/// - Parameter event: The RoktEvent to map
912
/// - Returns: The mapped MPRoktEvent, or nil if mapping fails
10-
@objc public static func mapEvent(_ event: RoktEvent) -> MPRoktEvent? {
13+
@objc(mapEvent:)
14+
public static func mapEvent(_ event: RoktEvent) -> MPRoktEvent? {
1115
switch event {
1216
case let initComplete as RoktEvent.InitComplete:
1317
return MPRoktEvent.MPRoktInitComplete(success: initComplete.success)
@@ -67,4 +71,4 @@ import Rokt_Widget
6771
return nil
6872
}
6973
}
70-
}
74+
}

mParticle-Rokt/mParticle_Rokt.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,3 @@
22

33
FOUNDATION_EXPORT double mParticle_RoktVersionNumber;
44
FOUNDATION_EXPORT const unsigned char mParticle_RoktVersionString[];
5-
6-
#if defined(__has_include) && __has_include(<mParticle_Appboy/MPKitAppboy.h>)
7-
#import <mParticle_Rokt/MPKitRokt.h>
8-
#else
9-
#import "MPKitRokt.h"
10-
#endif

0 commit comments

Comments
 (0)