Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
No issue: Add null as valid code
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketsroger authored and jonalmeida committed Jan 26, 2022
1 parent 04b4421 commit 5c6316e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private val validCodeSet = setOf(
"firefox-b-lg", "firefox-b-huawei-h1611", "firefox-b-is-oem1", "firefox-b-oem1",
"firefox-b-oem2", "firefox-b-tinno", "firefox-b-pn-wt", "firefox-b-pn-wt-us", "ubuntu",
"ffab", "ffcm", "ffhp", "ffip", "ffit", "ffnt", "ffocus", "ffos", "ffsb", "fpas", "fpsa",
"ftas", "ftsa", "newext", "1000969a"
"ftas", "ftsa", "newext", "1000969a", null
)

/**
Expand Down Expand Up @@ -48,7 +48,7 @@ internal fun getTrackKey(

// For Bug 1751920
if (!validCodeSet.contains(code)) {
code = null
code = "other"
}

// Glean doesn't allow code starting with a figure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class InContentTelemetryTest {
}

@Test
fun `GIVEN a Bing search WHEN trackPartnerUrlTypeMetric is called THEN emit an appropriate IN_CONTENT_SEARCH fact`() {
fun `GIVEN an invalid Bing search WHEN trackPartnerUrlTypeMetric is called THEN emit an appropriate IN_CONTENT_SEARCH fact`() {
val url = "https://www.bing.com/search?q=aaa&pc=MOZMBA"
val facts = mutableListOf<Fact>()
Facts.registerProcessor(object : FactProcessor {
Expand All @@ -143,7 +143,7 @@ class InContentTelemetryTest {
assertEquals(Component.FEATURE_SEARCH, facts[0].component)
assertEquals(Action.INTERACTION, facts[0].action)
assertEquals(InContentTelemetry.IN_CONTENT_SEARCH, facts[0].item)
assertEquals("bing.in-content.sap.none", facts[0].value)
assertEquals("bing.in-content.sap.other", facts[0].value)
}

@Test
Expand All @@ -166,7 +166,7 @@ class InContentTelemetryTest {
}

@Test
fun `GIVEN a invalid Google sap-follow-on WHEN trackPartnerUrlTypeMetric is called THEN emit an appropriate IN_CONTENT_SEARCH fact`() {
fun `GIVEN an invalid Google sap-follow-on WHEN trackPartnerUrlTypeMetric is called THEN emit an appropriate IN_CONTENT_SEARCH fact`() {
val url = "https://www.google.com/search?q=aaa&client=firefox-b-mTesting&oq=random"
val facts = mutableListOf<Fact>()
Facts.registerProcessor(object : FactProcessor {
Expand All @@ -181,7 +181,7 @@ class InContentTelemetryTest {
assertEquals(Component.FEATURE_SEARCH, facts[0].component)
assertEquals(Action.INTERACTION, facts[0].action)
assertEquals(InContentTelemetry.IN_CONTENT_SEARCH, facts[0].item)
assertEquals("google.in-content.sap-follow-on.none", facts[0].value)
assertEquals("google.in-content.sap-follow-on.other", facts[0].value)
}

@Test
Expand Down

0 comments on commit 5c6316e

Please sign in to comment.