-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 FXIOS-9680 [Unit Tests] Configure store to use var for testing builds #22070
Conversation
e3f0ccd
to
da7e1c8
Compare
@clarmso Bitrise is failing, we are thinking this is because we are using the |
f97f97a
to
05b62c7
Compare
Client.app: Coverage: 29.75
Generated by 🚫 Danger Swift against 368fee1 |
@FilippoZazzeroni It's passing, I'm crying with happy tears~ 🥳 |
) | ||
} | ||
|
||
private func setupTestingStore() { |
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.
It looks good to me, i don't know only for later tests, if we want to add an Utility class to make a custom store and to restore it to default.
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.
thanks @FilippoZazzeroni! Yes, you're right, I agree. I created a separate ticket for this though since I prefer to break up work in smaller chunks: https://mozilla-hub.atlassian.net/browse/FXIOS-10094
I'll probably also get the teams input on the best way to go about this since want to make sure that its clear down the row that this is something we need to do for testing.
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.
Perfect thank you Cyndi, yes that is top.
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.
Discussed that the setup and teardown of store will be cleaned up in a future PR and that work will go in FXIOS-10094 as we think about a better way to setup and teardown the stores.
@isabelrios @clarmso seems like this PR needs a review from your side as well, let me know if any issues! thank you~ |
@cyndichin 👍🏼 Let's see how this scheme behaves. If there are any issues, I will let you know. |
📜 Tickets
Jira ticket
Github issue
💡 Description
Context
The store was a global constant that could not be mocked for unit testing. This causes testing issues especially within the middlewares. This PR allows us to overwrite the store and be able to verify logic such as a dispatch of an action or validating state in the store.
Summary
Fennec_Testing
that duplicates theFennec
build, and adds an additional flag calledTESTING
under Custom Flags in the Build settings. This flag can be used to determine which code path to run. We want to have avar store
instead of thelet store
in the testing case.SWIFT_ACTIVE_COMPILATION_CONDITIONS
Fennec Scheme
to use theFennec_Testing
build configuration when running testsMicrosurveyMiddlewareTests
to override thestore
📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120
)Screenshots
Compile errors example: