Skip to content
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

[MBL-722] Full MockOptimizely Removal #1823

Merged
merged 9 commits into from May 24, 2023
Merged

Conversation

scottkicks
Copy link
Contributor

@scottkicks scottkicks commented May 23, 2023

πŸ“² What

Cleans up and removes deprecated optimizely code, updates library tests, and updates/re-records snapshot tests (this is why there are so many file changes)

πŸ€” Why

Remote Config is fully integrated now so the optimizely code is no longer being used and can be cleaned up.

πŸ›  How

  1. Remove each optimizely file, follow the build errors to remove unused code, triple check that the features that relied on optimizely flag values default to true (except comment flagging which should be false).
  2. Update existing tests and remove irrelevant ones in Library target
  3. Update snapshot tests and re-record the references if needed in Kickstarter-iOS target.

βœ… Acceptance criteria

Please review this commit by commit. There were a lot of snapshots updated.

  • The should behave entirely as before this change.
  • The only feature flags we have not are for the Consent Management Dialog and Facebook Interstitial features and both are off and should not be shown in the app

@scottkicks scottkicks added this to the release-5.8.0 milestone May 23, 2023
@scottkicks scottkicks self-assigned this May 23, 2023
@nativeksr
Copy link
Collaborator

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@kickstarter kickstarter deleted a comment from codecov bot May 23, 2023
@codecov
Copy link

codecov bot commented May 24, 2023

Codecov Report

Merging #1823 (092a39f) into main (c50512a) will decrease coverage by 0.11%.
The diff coverage is 98.59%.

@@            Coverage Diff             @@
##             main    #1823      +/-   ##
==========================================
- Coverage   84.45%   84.35%   -0.11%     
==========================================
  Files        1283     1276       -7     
  Lines      116650   115449    -1201     
  Branches    30953    30743     -210     
==========================================
- Hits        98521    97390    -1131     
+ Misses      17052    16992      -60     
+ Partials     1077     1067      -10     
Impacted Files Coverage Ξ”
Kickstarter-iOS/AppDelegateViewModel.swift 91.69% <ΓΈ> (-0.44%) ⬇️
Kickstarter-iOS/AppDelegateViewModelTests.swift 98.66% <ΓΈ> (+0.91%) ⬆️
...aymentMethods/Views/PaymentMethodsFooterView.swift 64.00% <0.00%> (+2.46%) ⬆️
Library/AppEnvironment.swift 93.06% <ΓΈ> (+1.42%) ⬆️
Library/Environment.swift 94.59% <ΓΈ> (-0.15%) ⬇️
Library/KeyValueStoreType.swift 92.50% <ΓΈ> (+1.91%) ⬆️
Library/TestHelpers/TestCase.swift 97.22% <ΓΈ> (-0.08%) ⬇️
...ibrary/TestHelpers/XCTestCase+AppEnvironment.swift 100.00% <ΓΈ> (ΓΈ)
Library/ViewModels/BetaToolsViewModelTests.swift 100.00% <ΓΈ> (ΓΈ)
...wModels/PledgeCTAContainerViewViewModelTests.swift 100.00% <ΓΈ> (+0.69%) ⬆️
... and 22 more

... and 2 files with indirect coverage changes

πŸ“£ We’re building smart automated test selection to slash your CI/CD build times. Learn more

@scottkicks scottkicks marked this pull request as ready for review May 24, 2023 13:16
@scottkicks scottkicks merged commit e7fdb3b into main May 24, 2023
7 checks passed
@scottkicks scottkicks deleted the test-optimizely-removal branch May 24, 2023 13:16
Copy link
Contributor

@msadoon msadoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so there's a lot here that is correct. But I really want you to focus on the changes that are needed here and understand why they need be reverted.

Please put together a PR that includes all these changes. I would like it if I only have to review it once so all these comments are considered and changes made. Ideally we should merge that PR after a single pass.

Please ask me any questions you have or if anything is unclear.

}
}

func testFeatureFlagClientConfiguration_IsSuccess() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottkicks Can we write a couple similar tests for our new remoteConfigClientConfiguredNotification and remoteConfigClientConfigurationFailedNotification?

let mockOptimizelyClient = MockOptimizelyClient()
|> \.features .~ [OptimizelyFeature.commentFlaggingEnabled.rawValue: false]

func testView_CurrentUser_LoggedIn_IsBacking() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottkicks So this exists already - testView_CurrentUser_LoggedIn_IsBacking_True why write it again?

@@ -198,8 +198,8 @@ final class LoginToutViewModelTests: TestCase {
}

func testFacebookLoginFlow_Success_WhenFBLoginDeprecationFlagDisabled() {
let mockOptimizelyClient = MockOptimizelyClient()
|> \.features .~ [OptimizelyFeature.facebookLoginDeprecationEnabled.rawValue: true]
let mockRemoteConfigClient = MockRemoteConfigClient()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottkicks Good replacement here.

Comment on lines 56 to 58
lazy var paymentSheetEnabled: Bool = {
featureSettingsPaymentSheetEnabled()
true
}()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottkicks Can just assign to true, no need to use a closure, and remove lazy

Comment on lines 75 to 77
lazy var paymentSheetEnabled: Bool = {
featurePaymentSheetEnabled()
true
}()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottkicks Again no need for lazy or the closure.

self.goToProject.assertValues([project])
}
}

func testGoToAddNewStripeCard_WithPaymentSheetEnabled_NoStoredCards_Success() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottkicks no need to add WithPaymentSheetEnabled to test name, as you did above, simplify the name to reflect the absence of the feature flag.

Comment on lines 415 to 417
private func campaignTabEnabled() -> Bool {
featureProjectPageStoryTabEnabled()
true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scottkicks This can be a private var. I know I made these changes for you initially, but think about the changes on your own too. Don't just copy what I do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants