-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from Countly/fix-ios-sdk
Added iOS sdk missing changes
- Loading branch information
Showing
7 changed files
with
295 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// CountlyBaseTestCase.swift | ||
// CountlyTests | ||
// | ||
// Created by Muhammad Junaid Akram on 27/12/2023. | ||
// Copyright © 2023 Alin Radut. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import Countly | ||
|
||
class CountlyBaseTestCase: XCTestCase { | ||
var countly: Countly! | ||
var deviceID: String = "" | ||
let appKey: String = "appkey" | ||
var host: String = "https://test.count.ly/" | ||
|
||
override func setUpWithError() throws { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
cleanupState() | ||
} | ||
|
||
func createBaseConfig() -> CountlyConfig { | ||
let config: CountlyConfig = CountlyConfig() | ||
config.appKey = appKey | ||
config.host = host | ||
config.enableDebug = true | ||
config.features = [CLYFeature.crashReporting]; | ||
return config | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
func cleanupState() { | ||
Countly.sharedInstance().halt(true) | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#import "CountlyCommon.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// CountlyTests.swift | ||
// CountlyTests | ||
// | ||
// Created by Muhammad Junaid Akram on 22/12/2023. | ||
// Copyright © 2023 Alin Radut. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import Countly | ||
|
||
|
||
class CountlyTests: CountlyBaseTestCase { | ||
|
||
// MARK: - Configuration Tests | ||
|
||
func testReInitWithDeviceId() throws { | ||
let config = createBaseConfig() | ||
// No Device ID provided during init | ||
Countly.sharedInstance().start(with: config); | ||
|
||
let sdkGeneratedDeviceID = Countly.sharedInstance().deviceID() | ||
XCTAssertTrue(CountlyCommon.sharedInstance().hasStarted, "Countly initialization failed.") | ||
XCTAssertTrue(Countly.sharedInstance().deviceIDType() == CLYDeviceIDType.IDFV, "Countly deviced id type should be IDFV when no device id is provided during init.") | ||
Countly.sharedInstance().halt(false) | ||
XCTAssertTrue(!CountlyCommon.sharedInstance().hasStarted, "Countly halt failed.") | ||
|
||
let deviceID = String(Int.random(in: 0..<100)) | ||
|
||
let newConfig = createBaseConfig() | ||
newConfig.deviceID = deviceID | ||
Countly.sharedInstance().start(with: newConfig); | ||
|
||
XCTAssertTrue(CountlyCommon.sharedInstance().hasStarted, "Countly initialization failed.") | ||
XCTAssertTrue(Countly.sharedInstance().deviceID() == sdkGeneratedDeviceID, "Countly device id not match with provided device id.") | ||
XCTAssertTrue(Countly.sharedInstance().deviceIDType() == CLYDeviceIDType.IDFV, "Countly deviced id type should be custom when device id is provided during init.") | ||
} | ||
|
||
func testPerformanceExample() async throws { | ||
// This is an example of a performance test case. | ||
measure { | ||
// Put the code you want to measure the time of here. | ||
} | ||
} | ||
|
||
|
||
func checkPersistentValues() { | ||
let countlyPersistency = CountlyPersistency.sharedInstance() | ||
if(countlyPersistency != nil) { | ||
if let queuedRequests = CountlyPersistency.sharedInstance().value(forKey: "queuedRequests") as? NSMutableArray, | ||
let recordedEvents = CountlyPersistency.sharedInstance().value(forKey: "recordedEvents") as? NSMutableArray, | ||
let startedEvents = CountlyPersistency.sharedInstance().value(forKey: "startedEvents") as? NSMutableDictionary, | ||
let isQueueBeingModified = CountlyPersistency.sharedInstance().value(forKey: "isQueueBeingModified") as? Bool { | ||
print("Successfully access private properties.") | ||
|
||
|
||
} | ||
else { | ||
print("Failed to access private properties.") | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../CountlySDKLimitsConfig.h |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Resettable.h |