Skip to content

Commit 2e3e496

Browse files
[Building Sync-ups Tutorial] fixes in "Testing the sync-up detail" chapter (#3579)
* Update SyncUpDetail tutorial intro to clarify state communication Modify tutorial introduction to accurately describe how the SyncUpDetail feature updates parent state using a shared property * Update SyncUpDetail tutorial test code to use `modify` and `withLock` Refactor test code to: - Use `modify` for nested state updates - Apply `withLock` for thread-safe state mutation when editing a sync-up * Restore the SyncUpDetail tutorial for testing the delete flow with `@Shared` property. * Remove the restored delete test Since it is already tested in the navigation section, I finally remove it and update the tutorial text to inform of that with a link to it. * Update Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail.tutorial --------- Co-authored-by: Stephen Celis <[email protected]>
1 parent 6d55b5c commit 2e3e496

11 files changed

+8
-226
lines changed

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0005.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct SyncUpDetailTests {
2222
var editedSyncUp = syncUp
2323
editedSyncUp.title = "Point-Free Evening Sync"
2424
await store.send(\.destination.edit.binding.syncUp, editedSyncUp) {
25-
$0.destination?.edit?.syncUp = editedSyncUp
25+
$0.destination?.modify(\.edit) { $0.syncUp = editedSyncUp }
2626
}
2727
}
2828
}

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0006.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ struct SyncUpDetailTests {
2222
var editedSyncUp = syncUp
2323
editedSyncUp.title = "Point-Free Evening Sync"
2424
await store.send(\.destination.edit.binding.syncUp, editedSyncUp) {
25-
$0.destination?.edit?.syncUp = editedSyncUp
25+
$0.destination?.modify(\.edit) { $0.syncUp = editedSyncUp }
2626
}
2727

2828
await store.send(.doneEditingButtonTapped) {
2929
$0.destination = nil
30-
$0.syncUp = editedSyncUp
30+
$0.$syncUp.withLock { $0 = editedSyncUp }
3131
}
3232
}
3333
}

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0001-previous.swift

Lines changed: 0 additions & 12 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0001.swift

Lines changed: 0 additions & 23 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0002.swift

Lines changed: 0 additions & 27 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0003.swift

Lines changed: 0 additions & 30 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0004.swift

Lines changed: 0 additions & 34 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0005.swift

Lines changed: 0 additions & 31 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0006.swift

Lines changed: 0 additions & 31 deletions
This file was deleted.

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0007.swift

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)