From ad9861db35300e669fa3d83b36f4316b1a458ac8 Mon Sep 17 00:00:00 2001 From: xiaoweii Date: Wed, 10 Apr 2024 18:06:35 +0800 Subject: [PATCH] chore: change channel to preset attribute --- Tests/ClickstreamTests/IntegrationTest.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/ClickstreamTests/IntegrationTest.swift b/Tests/ClickstreamTests/IntegrationTest.swift index dba9482..9825c1b 100644 --- a/Tests/ClickstreamTests/IntegrationTest.swift +++ b/Tests/ClickstreamTests/IntegrationTest.swift @@ -124,7 +124,7 @@ class IntegrationTest: XCTestCase { func testAddGlobalAttribute() throws { ClickstreamAnalytics.addGlobalAttributes([ - "channel": "AppStore", + ClickstreamAnalytics.Attr.APP_INSTALL_CHANNEL: "App Store", "level": 5.1, "class": 5, "isOpenNotification": true @@ -134,7 +134,7 @@ class IntegrationTest: XCTestCase { let testEvent = try getTestEvent() let eventAttribute = testEvent["attributes"] as! [String: Any] - XCTAssertEqual("AppStore", eventAttribute["channel"] as! String) + XCTAssertEqual("AppStore", eventAttribute[ClickstreamAnalytics.Attr.APP_INSTALL_CHANNEL] as! String) XCTAssertEqual(5.1, eventAttribute["level"] as! Double) XCTAssertEqual(5, eventAttribute["class"] as! Int) XCTAssertEqual(true, eventAttribute["isOpenNotification"] as! Bool) @@ -169,18 +169,18 @@ class IntegrationTest: XCTestCase { func testDeleteGlobalAttribute() throws { ClickstreamAnalytics.addGlobalAttributes([ - "channel": "AppStore", + ClickstreamAnalytics.Attr.APP_INSTALL_CHANNEL: "App Store", "level": 5.1, "class": 5, "isOpenNotification": true ]) - ClickstreamAnalytics.deleteGlobalAttributes("channel") + ClickstreamAnalytics.deleteGlobalAttributes(ClickstreamAnalytics.Attr.APP_INSTALL_CHANNEL) ClickstreamAnalytics.recordEvent("testEvent") Thread.sleep(forTimeInterval: 0.1) let testEvent = try getTestEvent() let eventAttribute = testEvent["attributes"] as! [String: Any] - XCTAssertNil(eventAttribute["channel"]) + XCTAssertNil(eventAttribute[ClickstreamAnalytics.Attr.APP_INSTALL_CHANNEL]) XCTAssertEqual(5.1, eventAttribute["level"] as! Double) XCTAssertEqual(5, eventAttribute["class"] as! Int) XCTAssertEqual(true, eventAttribute["isOpenNotification"] as! Bool)