Skip to content

Commit 8fe2c2f

Browse files
Convert RegistrationTests to not use IterableAPI static members
1 parent 21c667c commit 8fe2c2f

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

tests/swift-sdk-swift-tests/RegistrationTests.swift

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class RegistrationTests: XCTestCase {
2929
config.pushIntegrationName = "my-push-integration"
3030
config.sandboxPushIntegrationName = "my-sandbox-push-integration"
3131
config.pushPlatform = .production
32-
IterableAPI.initializeForTesting(apiKey: apiKey,
33-
config: config,
34-
networkSession: networkSession,
35-
notificationStateProvider: MockNotificationStateProvider(enabled: true))
36-
IterableAPI.email = "user@example.com"
32+
let internalAPI = IterableAPIInternal.initializeForTesting(apiKey: apiKey,
33+
config: config,
34+
networkSession: networkSession,
35+
notificationStateProvider: MockNotificationStateProvider(enabled: true))
36+
internalAPI.email = "user@example.com"
3737
let token = "zeeToken".data(using: .utf8)!
38-
IterableAPI.register(token: token, onSuccess: { _ in
38+
internalAPI.register(token: token, onSuccess: { _ in
3939
let body = networkSession.getRequestBody() as! [String: Any]
4040
TestUtils.validateMatch(keyPath: KeyPath(.email), value: "user@example.com", inDictionary: body)
4141
TestUtils.validateMatch(keyPath: KeyPath(.device, .applicationName), value: "my-push-integration", inDictionary: body)
@@ -81,10 +81,10 @@ class RegistrationTests: XCTestCase {
8181
config.pushIntegrationName = "my-push-integration"
8282
config.sandboxPushIntegrationName = "my-sandbox-push-integration"
8383
config.pushPlatform = .sandbox
84-
IterableAPI.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession)
85-
IterableAPI.email = "user@example.com"
84+
let internalAPI = IterableAPIInternal.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession)
85+
internalAPI.email = "user@example.com"
8686
let token = "zeeToken".data(using: .utf8)!
87-
IterableAPI.register(token: token, onSuccess: { _ in
87+
internalAPI.register(token: token, onSuccess: { _ in
8888
let body = networkSession.getRequestBody() as! [String: Any]
8989
TestUtils.validateMatch(keyPath: KeyPath(.device, .applicationName), value: config.sandboxPushIntegrationName, inDictionary: body)
9090
TestUtils.validateMatch(keyPath: KeyPath(.device, .platform), value: JsonValue.apnsSandbox.jsonValue as! String, inDictionary: body)
@@ -110,10 +110,10 @@ class RegistrationTests: XCTestCase {
110110
config.pushIntegrationName = "my-push-integration"
111111
config.sandboxPushIntegrationName = "my-sandbox-push-integration"
112112
config.pushPlatform = .auto
113-
IterableAPI.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession, apnsTypeChecker: MockAPNSTypeChecker(apnsType: .sandbox))
114-
IterableAPI.email = "user@example.com"
113+
let internalAPI = IterableAPIInternal.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession, apnsTypeChecker: MockAPNSTypeChecker(apnsType: .sandbox))
114+
internalAPI.email = "user@example.com"
115115
let token = "zeeToken".data(using: .utf8)!
116-
IterableAPI.register(token: token, onSuccess: { _ in
116+
internalAPI.register(token: token, onSuccess: { _ in
117117
let body = networkSession.getRequestBody() as! [String: Any]
118118
TestUtils.validateMatch(keyPath: KeyPath(.device, .applicationName), value: config.sandboxPushIntegrationName, inDictionary: body)
119119
TestUtils.validateMatch(keyPath: KeyPath(.device, .platform), value: JsonValue.apnsSandbox.jsonValue as! String, inDictionary: body)
@@ -139,10 +139,10 @@ class RegistrationTests: XCTestCase {
139139
config.pushIntegrationName = "my-push-integration"
140140
config.sandboxPushIntegrationName = "my-sandbox-push-integration"
141141
config.pushPlatform = .auto
142-
IterableAPI.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession, apnsTypeChecker: MockAPNSTypeChecker(apnsType: .production))
143-
IterableAPI.email = "user@example.com"
142+
let internalAPI = IterableAPIInternal.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession, apnsTypeChecker: MockAPNSTypeChecker(apnsType: .production))
143+
internalAPI.email = "user@example.com"
144144
let token = "zeeToken".data(using: .utf8)!
145-
IterableAPI.register(token: token, onSuccess: { _ in
145+
internalAPI.register(token: token, onSuccess: { _ in
146146
let body = networkSession.getRequestBody() as! [String: Any]
147147
TestUtils.validateMatch(keyPath: KeyPath(.device, .applicationName), value: config.pushIntegrationName, inDictionary: body)
148148
TestUtils.validateMatch(keyPath: KeyPath(.device, .platform), value: JsonValue.apnsProduction.jsonValue as! String, inDictionary: body)
@@ -166,10 +166,10 @@ class RegistrationTests: XCTestCase {
166166
let networkSession = MockNetworkSession(statusCode: 200)
167167
let config = IterableConfig()
168168
config.pushPlatform = .auto
169-
IterableAPI.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession)
170-
IterableAPI.email = "user@example.com"
169+
let internalAPI = IterableAPIInternal.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession)
170+
internalAPI.email = "user@example.com"
171171
let token = "zeeToken".data(using: .utf8)!
172-
IterableAPI.register(token: token, onSuccess: { _ in
172+
internalAPI.register(token: token, onSuccess: { _ in
173173
let body = networkSession.getRequestBody() as! [String: Any]
174174
TestUtils.validateMatch(keyPath: KeyPath(.device, .applicationName), value: TestUtils.appPackageName, inDictionary: body)
175175
TestUtils.validateMatch(keyPath: KeyPath(.device, .platform), value: JsonValue.apnsSandbox.jsonValue as! String, inDictionary: body)
@@ -193,10 +193,10 @@ class RegistrationTests: XCTestCase {
193193
let networkSession = MockNetworkSession(statusCode: 200)
194194
let config = IterableConfig()
195195
config.pushPlatform = .auto
196-
IterableAPI.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession, apnsTypeChecker: MockAPNSTypeChecker(apnsType: .production))
197-
IterableAPI.email = "user@example.com"
196+
let internalAPI = IterableAPIInternal.initializeForTesting(apiKey: apiKey, config: config, networkSession: networkSession, apnsTypeChecker: MockAPNSTypeChecker(apnsType: .production))
197+
internalAPI.email = "user@example.com"
198198
let token = "zeeToken".data(using: .utf8)!
199-
IterableAPI.register(token: token, onSuccess: { _ in
199+
internalAPI.register(token: token, onSuccess: { _ in
200200
let body = networkSession.getRequestBody() as! [String: Any]
201201
TestUtils.validateMatch(keyPath: KeyPath(.device, .applicationName), value: TestUtils.appPackageName, inDictionary: body)
202202
TestUtils.validateMatch(keyPath: KeyPath(.device, .platform), value: JsonValue.apnsProduction.jsonValue as! String, inDictionary: body)

0 commit comments

Comments
 (0)