Skip to content

Commit 6b881cc

Browse files
committed
chore(tests): Add Swift IAMIntegrationTests file
Add Swift `IAMIntegrationTests` test file and check for accessibility of `OSMessagingController` from the test file
1 parent f828623 commit 6b881cc

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
3C67F77A2BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C67F7792BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift */; };
9999
3C7021E32ECF0821001768C6 /* OneSignalFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E2400381D4FFC31008BDE70 /* OneSignalFramework.framework */; };
100100
3C7021E42ECF0821001768C6 /* OneSignalFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3E2400381D4FFC31008BDE70 /* OneSignalFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
101+
3C7021E92ECF0CF4001768C6 /* IAMIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */; };
101102
3C70FA672D0B68A100031066 /* OneSignalClientError.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C70FA652D0B68A100031066 /* OneSignalClientError.h */; settings = {ATTRIBUTES = (Public, ); }; };
102103
3C70FA682D0B68A100031066 /* OneSignalClientError.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C70FA662D0B68A100031066 /* OneSignalClientError.m */; };
103104
3C789DBD293C2206004CF83D /* OSFocusInfluenceParam.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A600B432453790700514A53 /* OSFocusInfluenceParam.m */; };
@@ -1286,6 +1287,8 @@
12861287
3C6299A82BEEA46C00649187 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
12871288
3C6299AA2BEEA4C000649187 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
12881289
3C67F7792BEB2B710085A0F0 /* SwitchUserIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchUserIntegrationTests.swift; sourceTree = "<group>"; };
1290+
3C7021E72ECF0CF3001768C6 /* OneSignalInAppMessagesTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OneSignalInAppMessagesTests-Bridging-Header.h"; sourceTree = "<group>"; };
1291+
3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IAMIntegrationTests.swift; sourceTree = "<group>"; };
12891292
3C70FA652D0B68A100031066 /* OneSignalClientError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalClientError.h; sourceTree = "<group>"; };
12901293
3C70FA662D0B68A100031066 /* OneSignalClientError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalClientError.m; sourceTree = "<group>"; };
12911294
3C7A39D42B7C18EE0082665E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
@@ -2103,6 +2106,8 @@
21032106
isa = PBXGroup;
21042107
children = (
21052108
3C01519B2C2E29F90079E076 /* IAMRequestTests.m */,
2109+
3C7021E82ECF0CF4001768C6 /* IAMIntegrationTests.swift */,
2110+
3C7021E72ECF0CF3001768C6 /* OneSignalInAppMessagesTests-Bridging-Header.h */,
21062111
);
21072112
path = OneSignalInAppMessagesTests;
21082113
sourceTree = "<group>";
@@ -3779,7 +3784,7 @@
37793784
};
37803785
3C01518D2C2E298E0079E076 = {
37813786
CreatedOnToolsVersion = 15.2;
3782-
LastSwiftMigration = 1520;
3787+
LastSwiftMigration = 1640;
37833788
TestTargetID = DEF5CCF02539321A0003E9CC;
37843789
};
37853790
3C115160289A259500565C41 = {
@@ -4189,6 +4194,7 @@
41894194
isa = PBXSourcesBuildPhase;
41904195
buildActionMask = 2147483647;
41914196
files = (
4197+
3C7021E92ECF0CF4001768C6 /* IAMIntegrationTests.swift in Sources */,
41924198
3C01519C2C2E29F90079E076 /* IAMRequestTests.m in Sources */,
41934199
);
41944200
runOnlyForDeploymentPostprocessing = 0;
@@ -5019,6 +5025,7 @@
50195025
PRODUCT_NAME = "$(TARGET_NAME)";
50205026
SWIFT_COMPILATION_MODE = wholemodule;
50215027
SWIFT_EMIT_LOC_STRINGS = NO;
5028+
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h";
50225029
SWIFT_VERSION = 5.0;
50235030
TARGETED_DEVICE_FAMILY = "1,2";
50245031
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/UnitTestApp";
@@ -5072,6 +5079,7 @@
50725079
PRODUCT_NAME = "$(TARGET_NAME)";
50735080
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
50745081
SWIFT_EMIT_LOC_STRINGS = NO;
5082+
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h";
50755083
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
50765084
SWIFT_VERSION = 5.0;
50775085
TARGETED_DEVICE_FAMILY = "1,2";
@@ -5119,6 +5127,7 @@
51195127
PRODUCT_NAME = "$(TARGET_NAME)";
51205128
SWIFT_COMPILATION_MODE = wholemodule;
51215129
SWIFT_EMIT_LOC_STRINGS = NO;
5130+
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalInAppMessagesTests/OneSignalInAppMessagesTests-Bridging-Header.h";
51225131
SWIFT_VERSION = 5.0;
51235132
TARGETED_DEVICE_FAMILY = "1,2";
51245133
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UnitTestApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/UnitTestApp";
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Modified MIT License
3+
4+
Copyright 2025 OneSignal
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
1. The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
2. All copies of substantial portions of the Software may only be used in connection
17+
with services provided by OneSignal.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
*/
27+
28+
import XCTest
29+
@testable import OneSignalInAppMessages
30+
31+
final class IAMIntegrationTests: XCTestCase {
32+
override func setUpWithError() throws {
33+
// Put setup code here. This method is called before the invocation of each test method in the class.
34+
}
35+
override func tearDownWithError() throws {
36+
// Put teardown code here. This method is called after the invocation of each test method in the class.
37+
}
38+
func testExample() throws {
39+
OneSignalLog.setLogLevel(.LL_VERBOSE)
40+
OneSignalInAppMessages.getFromServer("foobar")
41+
// OSMessagingController.sharedInstance()
42+
}
43+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//
2+
// Use this file to import your target's public headers that you would like to expose to Swift.
3+
//
4+

0 commit comments

Comments
 (0)