Skip to content

Commit

Permalink
feat: add test case for verify modify attributes in multiple thread
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu-xiaowei committed Jul 19, 2024
1 parent 86c9a95 commit 654cd9a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Tests/ClickstreamTests/IntegrationTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,26 @@ class IntegrationTest: XCTestCase {
XCTAssertEqual(1, eventCount)
}

func testModifyUserAttributesInMulitThread() throws {
for number in 1 ... 100 {
Task {
ClickstreamAnalytics.addUserAttributes([
"_user_age": 21,
"isFirstOpen": true,
"score": 85.2,
"_user_name": "name\(number)"
])
}
Task {
ClickstreamAnalytics.setUserId("userId\(number)")
}
Task {
ClickstreamAnalytics.recordEvent("testEvent\(number)")
}
}
Thread.sleep(forTimeInterval: 1)
}

// MARK: - Objc test

func testRecordEventForObjc() throws {
Expand Down

0 comments on commit 654cd9a

Please sign in to comment.