mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-20 09:11:33 +01:00
* Add `Store.init` that takes reducer builder * wip * wip * added some tests * wip * wip * wip --------- Co-authored-by: Brandon Williams <mbrandonw@hey.com>
31 lines
735 B
Swift
31 lines
735 B
Swift
import ComposableArchitecture
|
|
import XCTest
|
|
|
|
@testable import SwiftUICaseStudies
|
|
|
|
@MainActor
|
|
final class BindingFormTests: XCTestCase {
|
|
func testBasics() async {
|
|
let store = TestStore(initialState: BindingForm.State()) {
|
|
BindingForm()
|
|
}
|
|
|
|
await store.send(.set(\.$sliderValue, 2)) {
|
|
$0.sliderValue = 2
|
|
}
|
|
await store.send(.set(\.$stepCount, 1)) {
|
|
$0.sliderValue = 1
|
|
$0.stepCount = 1
|
|
}
|
|
await store.send(.set(\.$text, "Blob")) {
|
|
$0.text = "Blob"
|
|
}
|
|
await store.send(.set(\.$toggleIsOn, true)) {
|
|
$0.toggleIsOn = true
|
|
}
|
|
await store.send(.resetButtonTapped) {
|
|
$0 = BindingForm.State(sliderValue: 5, stepCount: 10, text: "", toggleIsOn: false)
|
|
}
|
|
}
|
|
}
|