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

[No Ticket] Full MockOptimizely Removal PR Fixes/Cleanup #1825

Merged
merged 8 commits into from
Jun 12, 2023
28 changes: 28 additions & 0 deletions Kickstarter-iOS/AppDelegateViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,34 @@ final class AppDelegateViewModelTests: TestCase {
self.presentViewController.assertValues([1])
}
}

func testRemoteConfigClientConfiguredNotification_Success() {
let mockService = MockService(serverConfig: ServerConfig.staging)

withEnvironment(apiService: mockService) {
self.postNotificationName.assertDidNotEmitValue()

self.vm.inputs.applicationDidFinishLaunching(application: UIApplication.shared, launchOptions: nil)

self.vm.inputs.didUpdateRemoteConfigClient()

self.postNotificationName.assertValues([.ksr_remoteConfigClientConfigured])
}
}

func testRemoteConfigClientConfigurationFailedNotification() {
let mockService = MockService(serverConfig: ServerConfig.staging)

withEnvironment(apiService: mockService) {
self.postNotificationName.assertDidNotEmitValue()

self.vm.inputs.applicationDidFinishLaunching(application: UIApplication.shared, launchOptions: nil)

self.vm.inputs.remoteConfigClientConfigurationFailed()

self.postNotificationName.assertValues([.ksr_remoteConfigClientConfigurationFailed])
}
}
}

private let backingForCreatorPushData: [String: Any] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,35 +174,6 @@ internal final class CommentsViewControllerTests: TestCase {
}
}

func testView_CurrentUser_LoggedIn_IsBacking() {
msadoon marked this conversation as resolved.
Show resolved Hide resolved
let mockService =
MockService(fetchProjectCommentsEnvelopeResult: .success(CommentsEnvelope.multipleCommentTemplate))

let project = Project.template
|> \.personalization.isBacking .~ true

combos(Language.allLanguages, [Device.phone4_7inch, Device.pad]).forEach {
language, device in
withEnvironment(
apiService: mockService,
currentUser: .template,
language: language
) {
let controller = CommentsViewController.configuredWith(project: project)
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller)
parent.view.frame.size.height = 1_100

self.scheduler.run()

assertSnapshot(
matching: parent.view,
as: .image,
named: "Comments - lang_\(language)_device_\(device)"
)
}
}
}

func testView_NoComments_ShouldShowEmptyState() {
AppEnvironment.pushEnvironment(
apiService: MockService(
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 1 addition & 3 deletions Library/ViewModels/PaymentMethodsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ public final class PaymentMethodsViewModel: PaymentMethodsViewModelType,
.materialize()
}

lazy var paymentSheetEnabled: Bool = {
true
}()
let paymentSheetEnabled: Bool = true

let deletePaymentMethodEvents = self.didDeleteCreditCardSignal
.map(first)
Expand Down
4 changes: 1 addition & 3 deletions Library/ViewModels/PledgePaymentMethodsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ public final class PledgePaymentMethodsViewModel: PledgePaymentMethodsViewModelT
let context = configureWithValue.map { $0.context }
let availableCardTypes = project.map { $0.availableCardTypes }.skipNil()

lazy var paymentSheetEnabled: Bool = {
true
}()
let paymentSheetEnabled: Bool = true

let storedCardsEvent = configureWithValue
.switchMap { _ in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ final class PledgePaymentMethodsViewModelTests: TestCase {
}
}

func testGoToAddNewStripeCard_WithPaymentSheetEnabled_NoStoredCards_Success() {
func testGoToAddNewStripeCard_NoStoredCards_Success() {
let project = Project.template
let graphUser = GraphUser.template |> \.storedCards .~ UserCreditCards.withCards([])
let response = UserEnvelope<GraphUser>(me: graphUser)
Expand Down
6 changes: 2 additions & 4 deletions Library/ViewModels/ProjectPamphletMainCellViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public final class ProjectPamphletMainCellViewModel: ProjectPamphletMainCellView
}

self.campaignTabShown = project.ignoreValues()
.map(campaignTabEnabled)
.map(value: campaignTabEnabled)
}

private let awakeFromNibProperty = MutableProperty(())
Expand Down Expand Up @@ -412,9 +412,7 @@ private func fundingStatus(forProject project: Project) -> String {
}
}

private func campaignTabEnabled() -> Bool {
true
}
private let campaignTabEnabled: Bool = true

typealias ConvertedCurrrencyProjectData = (pledgedAmount: Int, goalAmount: Int, country: Project.Country)

Expand Down