-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add check for same write key in multiple instances * Active writekey fixes --------- Co-authored-by: Brandon Sneed <[email protected]>
- Loading branch information
1 parent
51f56b9
commit 3c49330
Showing
6 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
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 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 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 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 |
---|---|---|
|
@@ -13,6 +13,9 @@ final class Analytics_Tests: XCTestCase { | |
|
||
let traits = MyTraits(email: "[email protected]") | ||
analytics.identify(userId: "brandon", traits: traits) | ||
|
||
waitUntilStarted(analytics: analytics) | ||
checkIfLeaked(analytics) | ||
} | ||
|
||
func testPluginConfigure() { | ||
|
@@ -28,6 +31,8 @@ final class Analytics_Tests: XCTestCase { | |
XCTAssertNotNil(ziggy.analytics) | ||
XCTAssertNotNil(myDestination.analytics) | ||
XCTAssertNotNil(goober.analytics) | ||
|
||
waitUntilStarted(analytics: analytics) | ||
} | ||
|
||
func testPluginRemove() { | ||
|
@@ -91,6 +96,7 @@ final class Analytics_Tests: XCTestCase { | |
XCTAssertEqual(ziggy1.receivedInitialUpdate, 1) | ||
XCTAssertEqual(ziggy2.receivedInitialUpdate, 1) | ||
|
||
checkIfLeaked(analytics) | ||
} | ||
|
||
|
||
|
@@ -160,6 +166,7 @@ final class Analytics_Tests: XCTestCase { | |
|
||
XCTAssertTrue(anonId != "") | ||
XCTAssertTrue(anonId.count == 36) // it's a UUID y0. | ||
waitUntilStarted(analytics: analytics) | ||
} | ||
|
||
func testContext() { | ||
|
@@ -560,7 +567,7 @@ final class Analytics_Tests: XCTestCase { | |
var timeline: Timeline | ||
let type: PluginType | ||
let key: String | ||
var analytics: Analytics? | ||
weak var analytics: Analytics? | ||
|
||
init(key: String) { | ||
self.key = key | ||
|
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 |
---|---|---|
|
@@ -56,7 +56,7 @@ class StorageTests: XCTestCase { | |
|
||
let analytics = Analytics(configuration: Configuration(writeKey: "test")) | ||
analytics.storage.hardReset(doYouKnowHowToUseThis: true) | ||
|
||
analytics.waitUntilStarted() | ||
// this will crash if it fails. | ||
let j = try! JSON(jsonSettings) | ||
analytics.storage.write(.settings, value: j) | ||
|
@@ -70,7 +70,7 @@ class StorageTests: XCTestCase { | |
|
||
func testBasicWriting() throws { | ||
let analytics = Analytics(configuration: Configuration(writeKey: "test")) | ||
|
||
analytics.waitUntilStarted() | ||
analytics.identify(userId: "brandon", traits: MyTraits(email: "[email protected]")) | ||
|
||
let userInfo: UserInfo? = analytics.store.currentState() | ||
|
@@ -91,6 +91,8 @@ class StorageTests: XCTestCase { | |
let analytics = Analytics(configuration: Configuration(writeKey: "test")) | ||
analytics.storage.hardReset(doYouKnowHowToUseThis: true) | ||
|
||
analytics.waitUntilStarted() | ||
|
||
var event = IdentifyEvent(userId: "brandon1", traits: try! JSON(with: MyTraits(email: "[email protected]"))) | ||
analytics.storage.write(.events, value: event) | ||
|
||
|
@@ -134,6 +136,8 @@ class StorageTests: XCTestCase { | |
let analytics = Analytics(configuration: Configuration(writeKey: "test")) | ||
analytics.storage.hardReset(doYouKnowHowToUseThis: true) | ||
|
||
analytics.waitUntilStarted() | ||
|
||
var event = IdentifyEvent(userId: "brandon1", traits: try! JSON(with: MyTraits(email: "[email protected]"))) | ||
analytics.storage.write(.events, value: event) | ||
|
||
|
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