Files
swift-composable-architectu…/Examples/CaseStudies/SwiftUICaseStudiesTests/01-GettingStarted-BindingBasicsTests.swift
Stephen Celis 767231d179 Add Store.init that takes reducer builder (#2087)
* Add `Store.init` that takes reducer builder

* wip

* wip

* added some tests

* wip

* wip

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2023-05-11 12:30:08 -07:00

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)
}
}
}