-
Notifications
You must be signed in to change notification settings - Fork 54
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
add a test displaying a system used as a feedback of another system #15
base: master
Are you sure you want to change the base?
Conversation
bonus points for those about to rock
|
||
let feedback1 = Feedback<String, String>(effects: { state -> AnyPublisher<String, Never> in | ||
if state.count % 3 == 1 { | ||
return Just("a").eraseToAnyPublisher() |
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.
I would suggest to add _a
so it's easier to understand what's happening in the assertion
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.
This is the best example I could write at the time that uses simple string manipulation to display a system within a system. The outer system sends the inner system a string, the inner system accepts the string and returns another string back to the outer system as an event. The Outer system then appends the string to it's state and then because we've reached a point in the inner systems where it will no longer send a new event. (state.count % 3 == 2)
Is that state. It isn't obvious because it is not written.
Looking at it 20 days later I've got to ask myself if it is a good choice for an example, not really? But it certainly is okay for testing that things should work.
However if I tried to keep your system of using _
to operate the events my simple use of '%' will no longer work since state.count will increase in a different way.
Any other recommendations? I can go farther, not use a string as the state but and make the internal state model something else, but I'd like your approval on that stylistically first since it will no longer be a file of test that always uses a simple string as it's state
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.
Looks good 👍
Just a small suggestion
@@ -179,9 +181,21 @@ struct SignInView: View { | |||
.textContentType(.newPassword) | |||
} | |||
Section { | |||
// Seems like a bug in switch view amimation |
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.
// Seems like a bug in switch view amimation | |
// Seems like a bug in switch view animation |
I hope you'll consider this a template of a better test that exercises the system within the system for a particular use case or more likely to be used in the real world way.