Skip to content

Commit

Permalink
Update parameter names
Browse files Browse the repository at this point in the history
  • Loading branch information
dus7 committed Nov 20, 2024
1 parent d85c92e commit 4a5d2e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGo/TabSwitcherOpenDailyPixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct TabSwitcherOpenDailyPixel {
}

private enum ParameterName {
static let tabCount = "TabCount"
static let newTabCount = "NewTabCount"
static let tabCount = "tab_count"
static let newTabCount = "new_tab_count"
}
}
17 changes: 11 additions & 6 deletions DuckDuckGoTests/TabSwitcherDailyPixelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ final class TabSwitcherDailyPixelTests: XCTestCase {

let parameters = pixel.parameters(with: tabs)

XCTAssertNotNil(parameters["TabCount"])
XCTAssertNotNil(parameters["NewTabCount"])
XCTAssertNotNil(parameters[ParameterName.tabCount])
XCTAssertNotNil(parameters[ParameterName.newTabCount])
}

func testIncludesProperCountsForParameters() {
Expand All @@ -38,8 +38,8 @@ final class TabSwitcherDailyPixelTests: XCTestCase {

let parameters = pixel.parameters(with: tabs)

XCTAssertEqual(parameters["TabCount"], "2-5")
XCTAssertEqual(parameters["NewTabCount"], "1-5")
XCTAssertEqual(parameters[ParameterName.tabCount], "2-5")
XCTAssertEqual(parameters[ParameterName.newTabCount], "1-5")
}

func testBucketsAggregation() {
Expand All @@ -62,7 +62,7 @@ final class TabSwitcherDailyPixelTests: XCTestCase {
for value in bucket.key {
let tabs = Array(repeating: Tab.mock(), count: value)

let countParameter = TabSwitcherOpenDailyPixel().parameters(with: tabs)["TabCount"]
let countParameter = TabSwitcherOpenDailyPixel().parameters(with: tabs)[ParameterName.tabCount]

XCTAssertEqual(countParameter, bucket.value)
}
Expand All @@ -81,7 +81,7 @@ final class TabSwitcherDailyPixelTests: XCTestCase {
for value in bucket.key {
let tabs = Array(repeating: Tab(), count: value)

let countParameter = TabSwitcherOpenDailyPixel().parameters(with: tabs)["NewTabCount"]
let countParameter = TabSwitcherOpenDailyPixel().parameters(with: tabs)[ParameterName.newTabCount]

XCTAssertEqual(countParameter, bucket.value)
}
Expand All @@ -94,3 +94,8 @@ private extension Tab {
Tab(link: Link(title: nil, url: URL("https://example.com")!))
}
}

private enum ParameterName {
static let newTabCount = "new_tab_count"
static let tabCount = "tab_count"
}

0 comments on commit 4a5d2e9

Please sign in to comment.