A library for helping build high quality forms in SwiftUI and TCA
0

Configure Feed

Select the types of activity you want to include in your feed.

Await form effect tasks in tests

authored by

Woodrow Melling and committed by
Tangled
(Jul 10, 2026, 7:24 PM +0300) 0db84ba0 50b99f4c

+6 -4
+6 -4
Tests/ComposableFormsTests/FormTests.swift
··· 64 64 } 65 65 66 66 @Test 67 - func fieldSubmittedStoresValidState() { 67 + func fieldSubmittedStoresValidState() async { 68 68 let store = TestStore( 69 69 initialState: TestForm.State( 70 70 value: TestValue(name: "Blob") ··· 73 73 TestForm() 74 74 } 75 75 76 - store.send(.fieldSubmitted(FieldID.name)) { 76 + let task = store.send(.fieldSubmitted(FieldID.name)) { 77 77 $0.focusedField = FieldID.status 78 78 $0.validation[FieldID.name] = .valid 79 79 } 80 + await task?.value 80 81 } 81 82 82 83 @Test ··· 474 475 } 475 476 476 477 @Test 477 - func scopedValueChangeRevalidatesChangedChildFieldWithErrors() { 478 + func scopedValueChangeRevalidatesChangedChildFieldWithErrors() async { 478 479 let store = TestStore( 479 480 initialState: NestedTestForm.State( 480 481 value: NestedValue(), ··· 487 488 NestedTestForm() 488 489 } 489 490 490 - store.modify { 491 + let task = store.modify { 491 492 $0.value.profile.displayName = "Blob" 492 493 } changes: { 493 494 $0.validation[NestedFieldID.profileDisplayName] = .valid 494 495 } 496 + await task?.value 495 497 } 496 498 497 499 @Test