Skip to content

Perform refactor using openai gpt-3.5-turbo #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ class AdClickAttributionPluginTest {
}

@Test
fun whenFeatureNameDoesNotMatchAdClickAttributionThenReturnFalse() {
fun `store - feature name does not match ad click attribution - returns false`() {
AdClickFeatureName.values().filter { it != FEATURE_NAME }.forEach {
assertFalse(testee.store(it.value, EMPTY_JSON_STRING))
}
}

@Test
fun whenFeatureNameMatchesAdClickAttributionThenReturnTrue() {
fun `store - feature name matches ad click attribution - returns true`() {
assertTrue(testee.store(FEATURE_NAME_VALUE, EMPTY_JSON_STRING))
}

@Test
fun whenFeatureNameMatchesAdClickAttributionAndIsEnabledThenStoreFeatureEnabled() {
fun `store - feature name matches ad click attribution and is enabled - store feature enabled`() {
val jsonString = FileUtilities.loadText(javaClass.classLoader!!, "json/ad_click_attribution.json")

testee.store(FEATURE_NAME_VALUE, jsonString)
Expand All @@ -71,7 +71,7 @@ class AdClickAttributionPluginTest {
}

@Test
fun whenFeatureNameMatchesAdClickAttributionAndIsNotEnabledThenStoreFeatureDisabled() {
fun `store - feature name matches ad click attribution and is not enabled - store feature disabled`() {
val jsonString = FileUtilities.loadText(javaClass.classLoader!!, "json/ad_click_attribution_disabled.json")

testee.store(FEATURE_NAME_VALUE, jsonString)
Expand All @@ -80,7 +80,7 @@ class AdClickAttributionPluginTest {
}

@Test
fun whenFeatureNameMatchesAdClickAttributionThenUpdateAllExistingLists() {
fun `whenFeatureNameMatchesAdClickAttributionThenUpdateAllExistingLists - update all existing lists`() {
val jsonString = FileUtilities.loadText(javaClass.classLoader!!, "json/ad_click_attribution.json")

testee.store(FEATURE_NAME_VALUE, jsonString)
Expand Down Expand Up @@ -124,7 +124,7 @@ class AdClickAttributionPluginTest {
}

@Test
fun whenFeatureNameMatchesAdClickAttributionAndHasMinSupportedVersionThenStoreMinSupportedVersion() {
fun `store - feature name matches ad click attribution and has min supported version - stores min supported version`() {
val jsonString = FileUtilities.loadText(javaClass.classLoader!!, "json/ad_click_attribution_min_supported_version.json")

testee.store(FEATURE_NAME_VALUE, jsonString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AdClickFeatureTogglesPluginTest {
}

@Test
fun whenIsEnabledCalledOnAdCLickFeatureNameThenReturnRepositoryValue() {
fun `isEnabled - ad click feature name - returns repository value`() {
whenever(adClickFeatureToggleRepository.get(AdClickFeatureName.AdClickAttributionFeatureName, false)).thenReturn(true)
Assert.assertEquals(true, plugin.isEnabled(AdClickFeatureName.AdClickAttributionFeatureName.value, false))

Expand All @@ -47,12 +47,12 @@ class AdClickFeatureTogglesPluginTest {
}

@Test
fun whenIsEnabledCalledOnOtherFeatureNameThenReturnRepositoryNull() {
fun `isEnabled - other feature name - return repository null`() {
Assert.assertNull(plugin.isEnabled(TestFeatureName().value, false))
}

@Test
fun whenIsEnabledAndFeatureIsAdCLickeatureThenReturnTrueWhenEnabled() =
fun `isEnabled - ad click feature enabled - returns true when enabled`() =
runTest {
givenAdCLickFeatureIsEnabled()

Expand All @@ -62,7 +62,7 @@ class AdClickFeatureTogglesPluginTest {
}

@Test
fun whenIsEnabledAndFeatureIsAdCLickFeatureThenReturnFalseWhenDisabled() =
fun `isEnabled - ad click feature disabled - returns false when disabled`() =
runTest {
givenAdCLickFeatureIsDisabled()

Expand All @@ -72,7 +72,7 @@ class AdClickFeatureTogglesPluginTest {
}

@Test
fun whenIsEnabledAndFeatureIsAdCLickFeatureThenReturnDefaultValueIfFeatureDoesNotExist() =
fun `isEnabled - ad click feature does not exist - returns default value`() =
runTest {
val defaultValue = true
givenAdCLickFeatureReturnsDefaultValue(defaultValue)
Expand All @@ -84,7 +84,7 @@ class AdClickFeatureTogglesPluginTest {
}

@Test
fun whenIsEnabledAndFeatureIsAdCLickFeatureAndAppVersionEqualToMinSupportedVersionThenReturnTrueWhenEnabled() =
fun `isEnabled - ad click feature enabled and app version equal to min supported version - returns true when enabled`() =
runTest {
givenAdCLickFeatureIsEnabled()
givenAppVersionIsEqualToMinSupportedVersion()
Expand All @@ -95,7 +95,7 @@ class AdClickFeatureTogglesPluginTest {
}

@Test
fun whenIsEnabledAndFeatureIsAdCLickFeatureAndAppVersionIsGreaterThanMinSupportedVersionThenReturnTrueWhenEnabled() =
fun `isEnabled - ad click feature enabled and app version greater than min supported version`() =
runTest {
givenAdCLickFeatureIsEnabled()
givenAppVersionIsGreaterThanMinSupportedVersion()
Expand All @@ -106,7 +106,7 @@ class AdClickFeatureTogglesPluginTest {
}

@Test
fun whenIsEnabledAndFeatureIsAdCLickFeatureAndAppVersionIsSmallerThanMinSupportedVersionThenReturnFalseWhenEnabled() =
fun `isEnabled - Ad click feature enabled - returns false when enabled`() =
runTest {
givenAdCLickFeatureIsEnabled()
givenAppVersionIsSmallerThanMinSupportedVersion()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DataRemovalAdClickWorkerTest {
}

@Test
fun whenDoWorkThenCallClearAllExpiredAsyncAndReturnSuccess() =
fun `doWork - clear all expired async - success`() =
runTest {
val worker = TestListenableWorkerBuilder<DataRemovalAdClickWorker>(context = context).build()
worker.adClickManager = mockAdClickManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class DuckDuckGoAdClickDataTest {
}

@Test
fun whenSetAdDomainForActiveTabCalledThenTheSameDomainIsRetrieved() {
fun `setAdDomainForActiveTab - same domain retrieved`() {
testee.setAdDomainTldPlusOne("host")

assertEquals("host", testee.getAdDomainTldPlusOne())
}

@Test
fun whenRemoveAdDomainForActiveTabCalledThenAdDomainForTabIsRemoved() {
fun `removeAdDomain - ad domain for tab removed`() {
testee.setAdDomainTldPlusOne("host")
assertEquals("host", testee.getAdDomainTldPlusOne())

Expand All @@ -50,7 +50,7 @@ class DuckDuckGoAdClickDataTest {
}

@Test
fun whenRemoveExemptionForActiveTabCalledThenAllExemptionForTabAreRemoved() {
fun `removeExemption - all exemptions removed`() {
testee.addExemption(dummyExpiration("host1"))
assertTrue(testee.isHostExempted("host1"))

Expand All @@ -60,7 +60,7 @@ class DuckDuckGoAdClickDataTest {
}

@Test
fun whenAddExemptionForActiveTabCalledForADifferentHostThenOnlyThatSecondHostExemptionExists() {
fun `addExemption - different host - only that second host exemption exists`() {
val host = "host1"
val otherHost = "host2"
testee.addExemption(dummyExpiration(host))
Expand Down
Loading