Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif committed Dec 15, 2023
1 parent a33aa72 commit 0366af4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Tests/AppStateTests/AppDependencyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ fileprivate protocol Networking {
func fetch()
}

fileprivate struct NetworkService: Networking {
fileprivate class NetworkService: Networking {
func fetch() {
fatalError()
}
}

fileprivate struct MockNetworking: Networking {
fileprivate class MockNetworking: Networking {
func fetch() {

}
Expand Down
18 changes: 10 additions & 8 deletions Tests/AppStateTests/SecureStateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ fileprivate extension Application {
}
}

fileprivate struct ExampleStoredValue {
fileprivate struct ExampleSecureValue {
@SecureState(\.secureValue) var token: String?
}

fileprivate class ExampleStoringViewModel: ObservableObject {
fileprivate class ExampleSecureViewModel: ObservableObject {
@SecureState(\.secureValue) var token: String?

func testPropertyWrapper() {
Expand All @@ -23,17 +23,19 @@ fileprivate class ExampleStoringViewModel: ObservableObject {

final class SecureStateTests: XCTestCase {
override class func setUp() {
Application.logging(isEnabled: true)
Application
.logging(isEnabled: true)
.load(dependency: \.keychain)
}

override class func tearDown() {
Application.logger.debug("StoredStateTests \(Application.description)")
Application.logger.debug("SecureStateTests \(Application.description)")
}

func testStoredState() {
func testSecureState() {
XCTAssertNil(Application.secureState(\.secureValue).value)

let secureValue = ExampleStoredValue()
let secureValue = ExampleSecureValue()

XCTAssertEqual(secureValue.token, nil)

Expand All @@ -45,7 +47,7 @@ final class SecureStateTests: XCTestCase {

XCTAssertNotEqual(secureValue.token, "QWERTY")

Application.logger.debug("StoredStateTests \(Application.description)")
Application.logger.debug("SecureStateTests \(Application.description)")

secureValue.token = nil

Expand All @@ -55,7 +57,7 @@ final class SecureStateTests: XCTestCase {
func testStoringViewModel() {
XCTAssertNil(Application.secureState(\.secureValue).value)

let viewModel = ExampleStoringViewModel()
let viewModel = ExampleSecureViewModel()

XCTAssertEqual(viewModel.token, nil)

Expand Down
4 changes: 3 additions & 1 deletion Tests/AppStateTests/SyncStateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ fileprivate class ExampleStoringViewModel: ObservableObject {
@available(iOS 15.0, watchOS 9.0, macOS 11.0, tvOS 15.0, *)
final class SyncStateTests: XCTestCase {
override class func setUp() {
Application.logging(isEnabled: true)
Application
.logging(isEnabled: true)
.load(dependency: \.icloudStore)
}

override class func tearDown() {
Expand Down

0 comments on commit 0366af4

Please sign in to comment.