Skip to content

Commit

Permalink
Update tests to hopefully pass
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif committed Sep 20, 2024
1 parent b3c5973 commit b26ee51
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions Tests/AppStateTests/AppStateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

0 comments on commit b26ee51

Please sign in to comment.