Skip to content

Commit 5636c23

Browse files
committed
Update unit test to properly react to store actions
1 parent 150782a commit 5636c23

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

WooCommerce/WooCommerceTests/ViewRelated/Products/Variations/ProductVariationsViewModelTests.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,18 @@ final class ProductVariationsViewModelTests: XCTestCase {
122122
ProductAttribute.fake().copy(attributeID: 2, name: "Color", options: ["Red", "Green", "Blue", "White", "Black"]),
123123
ProductAttribute.fake().copy(attributeID: 3, name: "Fabric", options: ["Cotton", "Nylon", "Polyester", "Silk", "Linen"]),
124124
])
125-
let viewModel = ProductVariationsViewModel(formType: .edit)
125+
126+
let stores = MockStoresManager(sessionManager: SessionManager.makeForTesting())
127+
stores.whenReceivingAction(ofType: ProductVariationAction.self) { action in
128+
switch action {
129+
case .synchronizeAllProductVariations(_, _, let onCompletion):
130+
onCompletion(.success(()))
131+
default:
132+
break
133+
}
134+
}
135+
136+
let viewModel = ProductVariationsViewModel(stores: stores, formType: .edit)
126137

127138
// When
128139
let error = waitFor { promise in

0 commit comments

Comments
 (0)