Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
FulcrumOne committed Nov 7, 2024
1 parent a00db14 commit e36f04d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Tests/Tests+ViewModel+PopupCentreStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private extension PopupCentreStackViewModelTests {
await appendPopupsAndPerformChecks(
popups: popups,
isKeyboardActive: isKeyboardActive,
calculatedValue: { $0.calculatePopupPadding() },
calculatedValue: { await $0.calculatePopupPadding() },
expectedValueBuilder: { _ in expectedValue }
)
}
Expand Down Expand Up @@ -236,13 +236,15 @@ private extension PopupCentreStackViewModelTests {
let config = getConfigForPopupHeightTests(cornerRadius: cornerRadius, popupPadding: popupPadding)
return AnyPopup.t_createNew(config: config).settingHeight(popupHeight)
}
func appendPopupsAndPerformChecks<Value: Equatable>(popups: [AnyPopup], isKeyboardActive: Bool, calculatedValue: @escaping (ViewModel) -> (Value), expectedValueBuilder: @escaping (ViewModel) -> Value) async {
func appendPopupsAndPerformChecks<Value: Equatable & Sendable>(popups: [AnyPopup], isKeyboardActive: Bool, calculatedValue: @escaping (ViewModel) async -> (Value), expectedValueBuilder: @escaping (ViewModel) async -> Value) async {
await viewModel.updatePopupsValue(popups)
await viewModel.updatePopupsValue(recalculatePopupHeights(viewModel))
await updatePopups(viewModel)
viewModel.updateKeyboardValue(isKeyboardActive)
viewModel.updateScreenValue(isKeyboardActive ? screenWithKeyboard : screen)

XCTAssertEqual(calculatedValue(viewModel), expectedValueBuilder(viewModel))
let calculatedValue = await calculatedValue(viewModel)
let expectedValue = await expectedValueBuilder(viewModel)
XCTAssertEqual(calculatedValue, expectedValue)
}
}
private extension PopupCentreStackViewModelTests {
Expand Down

0 comments on commit e36f04d

Please sign in to comment.