Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio committed Nov 15, 2024
1 parent ad3e912 commit 3394681
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGoTests/MockPrivacyConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import Combine
class MockPrivacyConfiguration: PrivacyConfiguration {

var isSubfeatureKeyEnabled: ((any PrivacySubfeature, AppVersionProvider) -> Bool)?
func isSubfeatureEnabled(_ subfeature: any PrivacySubfeature, versionProvider: AppVersionProvider, randomizer: (Range<Double>) -> Double) -> Bool {
func isSubfeatureEnabled(_ subfeature: any PrivacySubfeature, cohortID: CohortID?, versionProvider: AppVersionProvider, randomizer: (Range<Double>) -> Double) -> Bool {
isSubfeatureKeyEnabled?(subfeature, versionProvider) ?? false
}

func stateFor(_ subfeature: any PrivacySubfeature, versionProvider: AppVersionProvider, randomizer: (Range<Double>) -> Double) -> PrivacyConfigurationFeatureState {
func stateFor(_ subfeature: any PrivacySubfeature, cohortID: CohortID?, versionProvider: AppVersionProvider, randomizer: (Range<Double>) -> Double) -> PrivacyConfigurationFeatureState {
if isSubfeatureKeyEnabled?(subfeature, versionProvider) == true {
return .enabled
}
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGoTests/PrivacyConfigurationManagerMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ class PrivacyConfigurationMock: PrivacyConfiguration {
}

var enabledSubfeaturesForVersions: [String: Set<String>] = [:]
func isSubfeatureEnabled(_ subfeature: any PrivacySubfeature, versionProvider: AppVersionProvider, randomizer: (Range<Double>) -> Double) -> Bool {
func isSubfeatureEnabled(_ subfeature: any PrivacySubfeature, cohortID: CohortID?, versionProvider: AppVersionProvider, randomizer: (Range<Double>) -> Double) -> Bool {
return enabledSubfeaturesForVersions[subfeature.rawValue]?.contains(versionProvider.appVersion() ?? "") ?? false
}

func stateFor(_ subfeature: any PrivacySubfeature, versionProvider: BrowserServicesKit.AppVersionProvider, randomizer: (Range<Double>) -> Double) -> BrowserServicesKit.PrivacyConfigurationFeatureState {
if isSubfeatureEnabled(subfeature, versionProvider: versionProvider, randomizer: randomizer) {
func stateFor(_ subfeature: any PrivacySubfeature, cohortID: CohortID?, versionProvider: BrowserServicesKit.AppVersionProvider, randomizer: (Range<Double>) -> Double) -> BrowserServicesKit.PrivacyConfigurationFeatureState {
if isSubfeatureEnabled(subfeature, cohortID: cohortID, versionProvider: versionProvider, randomizer: randomizer) {
return .enabled
}
return .disabled(.disabledInConfig) // this is not used in platform tests, so mocking this poorly for now
Expand Down

0 comments on commit 3394681

Please sign in to comment.