From b26ee51684c7c6535b83f2b8891ce717481f58ee Mon Sep 17 00:00:00 2001 From: Leif Date: Thu, 19 Sep 2024 18:46:46 -0600 Subject: [PATCH] Update tests to hopefully pass --- Tests/AppStateTests/AppStateTests.swift | 54 +++++++++++++------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/Tests/AppStateTests/AppStateTests.swift b/Tests/AppStateTests/AppStateTests.swift index 1b00d4f..1795c84 100644 --- a/Tests/AppStateTests/AppStateTests.swift +++ b/Tests/AppStateTests/AppStateTests.swift @@ -89,30 +89,32 @@ final class AppStateTests: XCTestCase { XCTAssertEqual(appState.value, "0xL") XCTAssertEqual(Application.state(\.username).value, "0xL") } - -// func testStateClosureCachesValueOnGet() { -// let dateState: Application.State = Application.state(\.date) -// -// let copyOfDateState: Application.State = Application.state(\.date) -// -// XCTAssertEqual(copyOfDateState.value, dateState.value) -// } -// -// func testPropertyWrappers() { -// let exampleView = ExampleView() -// -// XCTAssertEqual(exampleView.username, "Leif") -// -// exampleView.testPropertyWrappers() -// -// XCTAssertEqual(exampleView.username, "Hello, ExampleView") -// -// let viewModel = ExampleViewModel() -// -// XCTAssertEqual(viewModel.username, "Hello, ExampleView") -// -// viewModel.username = "Hello, ViewModel" -// -// XCTAssertEqual(viewModel.username, "Hello, ViewModel") -// } + + @MainActor + func testStateClosureCachesValueOnGet() async { + let dateState: Application.State = Application.state(\.date) + + let copyOfDateState: Application.State = Application.state(\.date) + + XCTAssertEqual(copyOfDateState.value, dateState.value) + } + + @MainActor + func testPropertyWrappers() async { + let exampleView = ExampleView() + + XCTAssertEqual(exampleView.username, "Leif") + + exampleView.testPropertyWrappers() + + XCTAssertEqual(exampleView.username, "Hello, ExampleView") + + let viewModel = ExampleViewModel() + + XCTAssertEqual(viewModel.username, "Hello, ExampleView") + + viewModel.username = "Hello, ViewModel" + + XCTAssertEqual(viewModel.username, "Hello, ViewModel") + } }