Split up BackendTests into individual smaller test files for each NetworkOperation#1365
Merged
Conversation
NachoSoto
commented
Mar 7, 2022
| @@ -1,6 +0,0 @@ | |||
| { | |||
Contributor
Author
There was a problem hiding this comment.
This was really funny. This test ensures that only ONE request is made thanks to caching. Somehow we ran this test when that implementation was broken, which created this second request snapshot. After cleaning up the snapshots for the separate folders, this was the only change: this file now is removed because the implementation only makes one request!
cd4bf57 to
9d8a36f
Compare
49a5c46 to
96b69f1
Compare
…NetworkOperation` Before this change, `BackendTests` was an unmaintainable 1929 lines. Now we have much smaller tests for each type of operation: - `BackendCreateAliasTests.swift`: 165 - `BackendGetCustomerInfoTests.swift`: 169 - `BackendGetIntroEligibilityTests.swift`: 192 - `BackendGetOfferingsTests.swift`: 208 - `BackendLoginTests.swift`: 335 - `BackendPostAttributionDataTests.swift`: 42 - `BackendPostOfferForSigningTests.swift`: 262 - `BackendPostReceiptDataTests.swift`: 700 - `BackendPostSubscriberAttributesTests.swift`: 35 - `BaseBackendTest.swift`: 83
9d8a36f to
45cf437
Compare
1 task
aboedo
approved these changes
Mar 9, 2022
NachoSoto
added a commit
that referenced
this pull request
May 31, 2022
`PurchasesTests.swift` is nearly 3000 lines. This is the first step towards making separate smaller files like I did with `BackendTests.swift` in #1365.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this change,
BackendTestswas an unmaintainable 1929 lines.Now we have much smaller tests for each type of operation:
BackendCreateAliasTests.swift: 165BackendGetCustomerInfoTests.swift: 169BackendGetIntroEligibilityTests.swift: 192BackendGetOfferingsTests.swift: 208BackendLoginTests.swift: 335BackendPostAttributionDataTests.swift: 42BackendPostOfferForSigningTests.swift: 262BackendPostReceiptDataTests.swift: 700BackendPostSubscriberAttributesTests.swift: 35Additionally, each test file only has helpers and dummy data relevant for those operations, instead of all combined into the much larger file.
The
createClientoverride was necessary to make sure that the snapshots were split for each test class, which also makes navigating these much easier: