Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

PaulWoodIII
Copy link
Contributor

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.


let feedback1 = Feedback<String, String>(effects: { state -> AnyPublisher<String, Never> in
if state.count % 3 == 1 {
return Just("a").eraseToAnyPublisher()
Copy link
Owner

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

Copy link
Contributor Author

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

Copy link
Owner

@sergdort sergdort left a 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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Seems like a bug in switch view amimation
// Seems like a bug in switch view animation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants