- Fixes [TRIAGE-221] for `SK1`.
- Filed `FB11889732` for `SK2`.
### Changes:
- Added 2 `IntroEligibilityCalculatorTests` unit tests to cover this
scenario
- Added 1 `IntroEligibilityCalculatorTests` unit tests to cover the
equivalent of the `testIneligibleForIntroAfterPurchaseExpires`
integration test
- Added 2 `StoreKitIntegrationTests` to cover this scenario (one of them
disabled in SK2)
- Updated `IntroEligibilityCalculator` logic to fix the new tests.
- Refactored `IntroEligibilityCalculatorTests` to avoid duplication and
allow adding new cases more easily.
- Added a few more tests to ensure other cases are correct.
[TRIAGE-221]:
https://revenuecats.atlassian.net/browse/TRIAGE-221?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
The name `InAppPurchase` is too general. This type in particular is
specific to the content of `AppleReceipt`, so nesting it makes that
clear.
Follow up to #1933.
This will help us debug flaky tests.
Example:
> INFO: 😻💰 Purchased product -
'com.revenuecat.monthly_4.99.1_week_intro'
DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from
Apple.
DEBUG: ℹ️ Loaded receipt from url
file:///Users/nachosoto/Library/Developer/CoreSimulator/Devices/A3576DC2-355E-45BA-B32C-D2C0A3811BB4/data/Containers/Data/Application/EDF3B7C8-A4BD-4629-813E-0934528AF02E/StoreKit/receipt
INFO: ℹ️ Receipt parsed successfully
INFO: ℹ️ Receipt content:
["inAppPurchases": [], "creationDate": 2022-09-21 21:00:07 +0000,
"opaqueValue": 8 bytes, "applicationVersion": "1",
"originalApplicationVersion": "<unknown>", "bundleId":
"com.revenuecat.StoreKitTestApp", "expirationDate": 4001-01-01 00:00:00
+0000, "sha1Hash": 20 bytes]
/Users/nachosoto/dev/purchases-ios/Tests/BackendIntegrationTests/StoreKitIntegrationTests.swift:64:
error: -[BackendIntegrationTests.StoreKit2IntegrationTests
testCanPurchaseProduct] : failed - Expected Entitlement. Got: [:]
expected to have Dictionary<String, EntitlementInfo> with count 1, got 0
Actual Value: [:]
I've also added the receipt as a test attachment so we can download it
from `CircleCI`:

* made a few attributes that aren't present in SKTest receipts optional, added test with IAP
* added more tests for every field in the receipt
* fixed a few places where `asDict` wasn't correctly considering nullability in the IAP receipt fields
* fixed length calculation for indefinite-length containers
* temporarily removed the early return from empty receipts
* fixed length calculation when parsing receipts with indefinite length
* fix linting
* added basic ugly test
* fixed local receipt parsing for sktest, broke regular receipt parsing temporarily
* updated length calculation so that it works for both storekit test and regular receipts
* updated test to allow for missing OriginalAppVersion in receipt
* fixed linting in imports
* fixed checks for non-storekitTest receipts
* added a longer comment to explain the length == 0 case
* cleaned up the still-ugly tests for the receipt parser