Skip to content

Instantly share code, notes, and snippets.

@arifinfrds
Created November 6, 2020 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arifinfrds/95ef7588ca78333fb5c68da637f4be97 to your computer and use it in GitHub Desktop.
Save arifinfrds/95ef7588ca78333fb5c68da637f4be97 to your computer and use it in GitHub Desktop.
Example of Unit Testing without SUT
func test_load_shouldRespondSomething() {
let analytic: Inalytic = AnalayticSpy()
let storageClient: IUserDefaults = UserDefaultsSpy()
let serviceClient: IHTTPClient = HTTPClientSpy()
let storage: TextToSpeechPreferencesStorage = TextToSpeechPreferencesStorageImpl(client: storageClient)
let service: TextToSpeechPreferencesService = TextToSpeechPreferencesServiceImpl(client: serviceClient)
let repository: TextToSpeechPreferencesRepository = TextToSpeechPreferencesRepositoryImpl(
storage: storage,
service: service
)
let useCase: LoadLanguageIdPreferencesUseCase = LoadLanguageIdPreferencesUseCaseImpl(
repository: repository,
analytic: analytic
)
// ...
// other code
XCTAssertNotNil(useCase)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment