-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/home view model test #196
base: main
Are you sure you want to change the base?
Feature/home view model test #196
Conversation
add final to class Co-authored-by: Leonardo <[email protected]>
solving problem with string test Co-authored-by: Leonardo <[email protected]>
Co-authored-by: Leonardo <[email protected]>
…trollerExtensionsTests.swift Co-authored-by: Leonardo <[email protected]>
…trollerExtensionsTests.swift Co-authored-by: Leonardo <[email protected]>
Feature/removing spaces
…roller Feature/inside navigation controller
DispatchQueueSpy created
let delegateSpy = HomeViewModelDelegateSpy() | ||
lazy var sut = HomeViewModel(financeService: financeServiceSpy, dispatchQueue: dispatchQueueSpy) | ||
|
||
func test_didFetchHomeData_isCalled () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func test_didFetchHomeData_isCalled () { | |
func test_fetchHomeData_shouldCallDelegate() { |
XCTAssertTrue(delegateSpy.delegateIsCalled) | ||
} | ||
|
||
func test_fetchHomeDataAndDispatchQueue_isCalled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func test_fetchHomeDataAndDispatchQueue_isCalled() { | |
func test_fetchHomeData_whenDataIsNotNil_shouldCallDispatch() { |
XCTAssertTrue(dispatchQueueSpy.isDispatchCalled) | ||
} | ||
|
||
func test_fetchData_shouldNotCallDelegate_whenHomedataIsNill () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func test_fetchData_shouldNotCallDelegate_whenHomedataIsNill () { | |
func test_fetchData_whenHomedataIsNill _shouldNotCallDelegate() { |
} | ||
|
||
class HomeViewModelDelegateSpy: HomeViewModelDelegate { | ||
var delegateIsCalled: Bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var delegateIsCalled: Bool = false | |
private(set) var delegateIsCalled: Bool = false |
|
||
class FinanceServiceSpy: FetchHomeDataProtocol { | ||
|
||
var homeData: HomeData? = HomeData(balance: 0, savings: 0, spending: 0, activity: [Activity(name: "", price: 0, time: "")]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O que você acha de utilizarmos uma fixture
class FinanceServiceSpy: FetchHomeDataProtocol { | ||
|
||
var homeData: HomeData? = HomeData(balance: 0, savings: 0, spending: 0, activity: [Activity(name: "", price: 0, time: "")]) | ||
var fetchHomeDataIsCalled: Bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var fetchHomeDataIsCalled: Bool = false | |
private(set) var fetchHomeDataIsCalled: Bool = false |
@@ -5,7 +5,12 @@ import Foundation | |||
@testable import FinanceApp | |||
|
|||
public class DispatchQueueSpy: DispatchQueueProtocol { | |||
|
|||
var isDispatchCalled: Bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var isDispatchCalled: Bool = false | |
private(set) var isDispatchCalled: Bool = false |
@@ -5,7 +5,12 @@ import Foundation | |||
@testable import FinanceApp | |||
|
|||
public class DispatchQueueSpy: DispatchQueueProtocol { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public class DispatchQueueSpy: DispatchQueueProtocol { | |
final class DispatchQueueSpy: DispatchQueueProtocol { |
------------ APAGAR ------------
Emojis para os titulos dos MR's
More on: https://gitmoji.dev
------------ APAGAR ------------
Descrição simples da nova feature
Checklist:
Coloque um
x
nas caixas que se aplicam.Evidências da feature: