mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-20 09:11:33 +01:00
58 lines
1.4 KiB
Swift
58 lines
1.4 KiB
Swift
import InlineSnapshotTesting
|
|
import TestCases
|
|
import XCTest
|
|
|
|
final class iOS17_ObservableOptionalTests: BaseIntegrationTests {
|
|
@MainActor
|
|
override func setUp() {
|
|
super.setUp()
|
|
self.app.buttons["iOS 17"].tap()
|
|
self.app.buttons["Optional"].tap()
|
|
self.clearLogs()
|
|
// SnapshotTesting.isRecording = true
|
|
}
|
|
|
|
@MainActor
|
|
func testBasics() {
|
|
self.app.buttons["Toggle"].tap()
|
|
XCTAssertEqual(self.app.staticTexts["0"].exists, true)
|
|
XCTAssertEqual(self.app.staticTexts["1"].exists, false)
|
|
self.assertLogs {
|
|
"""
|
|
ObservableBasicsView.body
|
|
ObservableOptionalView.body
|
|
StoreOf<ObservableBasicsView.Feature>.init
|
|
"""
|
|
}
|
|
self.app.buttons["Increment"].tap()
|
|
XCTAssertEqual(self.app.staticTexts["0"].exists, false)
|
|
XCTAssertEqual(self.app.staticTexts["1"].exists, true)
|
|
self.assertLogs {
|
|
"""
|
|
ObservableBasicsView.body
|
|
"""
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
func testParentObserveChild() {
|
|
self.app.buttons["Toggle"].tap()
|
|
self.app.buttons["Increment"].tap()
|
|
self.clearLogs()
|
|
self.app.buttons["Observe count"].tap()
|
|
XCTAssertEqual(self.app.staticTexts["Count: 1"].exists, true)
|
|
self.assertLogs {
|
|
"""
|
|
ObservableOptionalView.body
|
|
"""
|
|
}
|
|
self.app.buttons["Increment"].tap()
|
|
self.assertLogs {
|
|
"""
|
|
ObservableBasicsView.body
|
|
ObservableOptionalView.body
|
|
"""
|
|
}
|
|
}
|
|
}
|