UITests and Mock Screens

Adds the test targets for Unit and UI tests
Adds mock screen data and utilities to render each mock screen for previews/ui tests.
Changes Published property in the service to CurrentValueSubject. we don't need the synthesized aspect of Published and property wrappers cannot be included in protocols.
This commit is contained in:
David Langley
2021-09-09 16:23:00 +01:00
parent c7524fd16e
commit 2d212ddd8e
14 changed files with 306 additions and 37 deletions

View File

@@ -36,7 +36,7 @@ class TemplateUserProfileViewModel: ObservableObject, TemplateUserProfileViewMod
self.userService = userService
self.viewState = initialState ?? Self.defaultState(userService: userService)
userService.presencePublisher
userService.presenceSubject
.map(TemplateUserProfileStateAction.updatePresence)
.receive(on: DispatchQueue.main)
.sink(receiveValue: { [weak self] action in
@@ -46,7 +46,7 @@ class TemplateUserProfileViewModel: ObservableObject, TemplateUserProfileViewMod
}
private static func defaultState(userService: TemplateUserProfileServiceProtocol) -> TemplateUserProfileViewState {
return TemplateUserProfileViewState(avatar: userService.avatarData, displayName: userService.displayName, presence: .offline)
return TemplateUserProfileViewState(avatar: userService.avatarData, displayName: userService.displayName, presence: userService.presenceSubject.value)
}
// MARK: - Public