Skip to content

Commit 11b791c

Browse files
committed
Add unit tests
1 parent 2a6e164 commit 11b791c

6 files changed

Lines changed: 224 additions & 40 deletions

File tree

mParticle-Rokt.xcodeproj/project.pbxproj

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
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 */; };
1514
B3D778532E02845700D887A4 /* MPRoktEventMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */; };
16-
B3D778582E028ACD00D887A4 /* MPRoktEventMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */; };
15+
B3D778652E03996A00D887A4 /* mParticle-Apple-SDK in Frameworks */ = {isa = PBXBuildFile; productRef = B3D778642E03996A00D887A4 /* mParticle-Apple-SDK */; };
16+
B3D778682E039F3B00D887A4 /* MPRoktEventMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */; };
17+
B3D7786D2E03C87100D887A4 /* mParticle-Apple-SDK in Frameworks */ = {isa = PBXBuildFile; productRef = B3D7786C2E03C87100D887A4 /* mParticle-Apple-SDK */; };
1718
DBB01A601DC1478A00A7B188 /* mParticle_Rokt.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A5E1DC1478A00A7B188 /* mParticle_Rokt.h */; settings = {ATTRIBUTES = (Public, ); }; };
1819
DBB01A681DC1480700A7B188 /* MPKitRokt.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A661DC1480700A7B188 /* MPKitRokt.h */; };
1920
DBB01A691DC1480700A7B188 /* MPKitRokt.m in Sources */ = {isa = PBXBuildFile; fileRef = DBB01A671DC1480700A7B188 /* MPKitRokt.m */; };
@@ -33,7 +34,6 @@
3334

3435
/* Begin PBXFileReference section */
3536
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>"; };
3737
DBB01A5B1DC1478A00A7B188 /* mParticle_Rokt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mParticle_Rokt.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3838
DBB01A5E1DC1478A00A7B188 /* mParticle_Rokt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mParticle_Rokt.h; sourceTree = "<group>"; };
3939
DBB01A5F1DC1478A00A7B188 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -49,8 +49,9 @@
4949
isa = PBXFrameworksBuildPhase;
5050
buildActionMask = 2147483647;
5151
files = (
52+
B3D778652E03996A00D887A4 /* mParticle-Apple-SDK in Frameworks */,
53+
B3D7786D2E03C87100D887A4 /* mParticle-Apple-SDK in Frameworks */,
5254
2502325C2D7A7BF3004794A2 /* Rokt-Widget in Frameworks */,
53-
536803952B7BAE11000A10BE /* mParticle-Apple-SDK in Frameworks */,
5455
);
5556
runOnlyForDeploymentPostprocessing = 0;
5657
};
@@ -90,7 +91,6 @@
9091
DBB01A5D1DC1478A00A7B188 /* mParticle-Rokt */ = {
9192
isa = PBXGroup;
9293
children = (
93-
B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */,
9494
B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */,
9595
DBB01A661DC1480700A7B188 /* MPKitRokt.h */,
9696
DBB01A671DC1480700A7B188 /* MPKitRokt.m */,
@@ -123,7 +123,6 @@
123123
isa = PBXHeadersBuildPhase;
124124
buildActionMask = 2147483647;
125125
files = (
126-
B3D778582E028ACD00D887A4 /* MPRoktEventMapper.h in Headers */,
127126
DBB01A601DC1478A00A7B188 /* mParticle_Rokt.h in Headers */,
128127
DBB01A681DC1480700A7B188 /* MPKitRokt.h in Headers */,
129128
);
@@ -147,8 +146,9 @@
147146
);
148147
name = "mParticle-Rokt";
149148
packageProductDependencies = (
150-
536803942B7BAE11000A10BE /* mParticle-Apple-SDK */,
151149
2502325B2D7A7BF3004794A2 /* Rokt-Widget */,
150+
B3D778642E03996A00D887A4 /* mParticle-Apple-SDK */,
151+
B3D7786C2E03C87100D887A4 /* mParticle-Apple-SDK */,
152152
);
153153
productName = "mParticle-Rokt";
154154
productReference = DBB01A5B1DC1478A00A7B188 /* mParticle_Rokt.framework */;
@@ -203,9 +203,9 @@
203203
);
204204
mainGroup = DBB01A511DC1478A00A7B188;
205205
packageReferences = (
206-
536803932B7BAE11000A10BE /* XCRemoteSwiftPackageReference "mparticle-apple-sdk" */,
207206
2502325A2D7A7BF3004794A2 /* XCRemoteSwiftPackageReference "rokt-sdk-ios" */,
208207
7EE7F13C2DA95BEE006C5440 /* XCRemoteSwiftPackageReference "ocmock" */,
208+
B3D7786B2E03C87100D887A4 /* XCRemoteSwiftPackageReference "mparticle-apple-sdk" */,
209209
);
210210
productRefGroup = DBB01A5C1DC1478A00A7B188 /* Products */;
211211
projectDirPath = "";
@@ -239,7 +239,7 @@
239239
isa = PBXSourcesBuildPhase;
240240
buildActionMask = 2147483647;
241241
files = (
242-
B3D778522E02845700D887A4 /* MPRoktEventMapper.swift in Sources */,
242+
B3D778682E039F3B00D887A4 /* MPRoktEventMapper.swift in Sources */,
243243
DBB01A691DC1480700A7B188 /* MPKitRokt.m in Sources */,
244244
);
245245
runOnlyForDeploymentPostprocessing = 0;
@@ -289,6 +289,7 @@
289289
COPY_PHASE_STRIP = NO;
290290
CURRENT_PROJECT_VERSION = 1;
291291
DEBUG_INFORMATION_FORMAT = dwarf;
292+
DEFINES_MODULE = YES;
292293
ENABLE_STRICT_OBJC_MSGSEND = YES;
293294
ENABLE_TESTABILITY = YES;
294295
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -340,6 +341,7 @@
340341
COPY_PHASE_STRIP = NO;
341342
CURRENT_PROJECT_VERSION = 1;
342343
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
344+
DEFINES_MODULE = YES;
343345
ENABLE_NS_ASSERTIONS = NO;
344346
ENABLE_STRICT_OBJC_MSGSEND = YES;
345347
GCC_C_LANGUAGE_STANDARD = gnu99;
@@ -560,7 +562,7 @@
560562
package = 2502325A2D7A7BF3004794A2 /* XCRemoteSwiftPackageReference "rokt-sdk-ios" */;
561563
productName = "Rokt-Widget";
562564
};
563-
536803942B7BAE11000A10BE /* mParticle-Apple-SDK */ = {
565+
B3D7786B2E03C87100D887A4 /* mParticle-Apple-SDK */ = {
564566
isa = XCSwiftPackageProductDependency;
565567
package = 536803932B7BAE11000A10BE /* XCRemoteSwiftPackageReference "mparticle-apple-sdk" */;
566568
productName = "mParticle-Apple-SDK";
@@ -580,6 +582,14 @@
580582
package = 7EE7F13C2DA95BEE006C5440 /* XCRemoteSwiftPackageReference "ocmock" */;
581583
productName = OCMock;
582584
};
585+
B3D778642E03996A00D887A4 /* mParticle-Apple-SDK */ = {
586+
isa = XCSwiftPackageProductDependency;
587+
productName = "mParticle-Apple-SDK";
588+
};
589+
B3D7786C2E03C87100D887A4 /* mParticle-Apple-SDK */ = {
590+
isa = XCSwiftPackageProductDependency;
591+
productName = "mParticle-Apple-SDK";
592+
};
583593
/* End XCSwiftPackageProductDependency section */
584594
};
585595
rootObject = DBB01A521DC1478A00A7B188 /* Project object */;

mParticle-Rokt/MPKitRokt.m

Lines changed: 4 additions & 4 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

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)