-
Notifications
You must be signed in to change notification settings - Fork 86
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
Mock for Combine #175
Comments
We are currently facing the same issue. After investigating it a bit, it only fails to generate the mock as a public enum FooEnum {
case one, two, three
}
/// @mockable(combine: fooPublisher = CurrentValueSubject; barPublisher = CurrentValueSubject)
public protocol SomeStream: AnyObject {
var fooPublisher: AnyPublisher<FooEnum, Never> { get }
var barPublisher: AnyPublisher<Bool, Never> { get }
} In these lines of code, mockolo will decide to fall back to a As mockolo is already capable of adding parameters to the Alternatively, we could probably add a new case to the var someStream = SomeStreamMock()
let someSubject = CurrentValueSubject<FooEnum, Never>(.one)
someStream.fooPublisher = someSubject.eraseToAnyPublisher() |
I believe this was fixed in #186 ? |
@keithcml Can you confirm that it is fixed? |
Just ran in the same situation. Thank you @ffittschen for the investigation. How did you work around in your code base? Btw. #186 does not fix the root cause. It adds a new flag to disable Subject synthesis for all AnyPublisher properties. |
I try to fix this issue by adding a new metadata to set a default value of CurrentValueSubject in #234. If you have any advice, please let me know. |
After reviewing my idea, I believe we can resolve this issue by using the |
I have tried to annotate with the following for my AnyPublisher
But the generator produces PassthroughSubject as
I would expect there is a CurrentValueSubject instead.
The text was updated successfully, but these errors were encountered: