File tree Expand file tree Collapse file tree
SwiftUIExamples/SwiftUIExamplesTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,13 @@ final class GitHubReposAsyncTests: XCTestCase {
2020 throw FakeError ( )
2121 }
2222 }
23-
23+
24+ class InvalidUsernameService : GitHubServiceProtocol {
25+ func fetchRepos( for username: String ) async throws -> [ GitHubRepo ] {
26+ throw GitHubServiceError . invalidURL
27+ }
28+ }
29+
2430 func testLoadRepos_Success( ) async throws {
2531 let viewModel = RepoListViewModel ( service: MockSuccessService ( ) )
2632 await viewModel. loadRepos ( for: " janeshsutharios " )
@@ -70,11 +76,6 @@ final class GitHubReposAsyncTests: XCTestCase {
7076 }
7177
7278 func testLoadRepos_InvalidUsername( ) async throws {
73- struct InvalidUsernameService : GitHubServiceProtocol {
74- func fetchRepos( for username: String ) async throws -> [ GitHubRepo ] {
75- throw GitHubServiceError . invalidURL
76- }
77- }
7879
7980 let viewModel = RepoListViewModel ( service: InvalidUsernameService ( ) )
8081 await viewModel. loadRepos ( for: " invalid@@@username " )
You can’t perform that action at this time.
0 commit comments