Files
swift-composable-architectu…/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/TestingNavigation-01-code-0008.swift
Brandon Williams 307c851709 New tutorial: Building SyncUps. (#3039)
* New tutorial: Building SyncUps.

* fix

* clean up

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-05-08 11:15:50 -07:00

35 lines
958 B
Swift

import ComposableArchitecture
import XCTest
@testable import SyncUps
final class AppFeatureTests: XCTestCase {@MainActor
func testDelete() async throws {
let syncUp = SyncUp.mock
@Shared(.syncUps) var syncUps = [syncUp]
let store = TestStore(initialState: AppFeature.State()) {
AppFeature()
}
let sharedSyncUp = try XCTUnwrap($syncUps[id: syncUp.id])
await store.send(\.path.push, (id: 0, .detail(SyncUpDetail.State(syncUp: sharedSyncUp)))) {
$0.path[id: 0] = .detail(SyncUpDetail.State(syncUp: sharedSyncUp))
}
await store.send(\.path[id:0].detail.deleteButtonTapped) {
$0.path[id: 0]?.detail?.destination = .alert(.deleteSyncUp)
}
await store.send(\.path[id:0].detail.destination.alert.confirmButtonTapped) {
$0.path[id: 0, case: \.detail]?.destination = nil
$0.syncUpsList.syncUps = []
}
await store.receive(\.path.popFrom) {
$0.path = StackState()
}
}
}