Commit Graph
6 Commits
Author SHA1 Message Date
NachoSoto 18c41c5e36 LocalReceiptParserStoreKitTests: relaxed purchaseDate expectation (#1605)
I often get failures when running all tests in parallel because this test takes more than 1 second to run.

Example:
> failed - expected to be close to <2022-05-24 10:59:18.3370> (within 1), got <2022-05-24 10:58:18.0000>

To allow the test to take a few more seconds, I think this is a reasonable compromise.
2022-05-26 14:54:30 -07:00
NachoSoto 16e3e64a52 Added XCTAsyncUnwrap to simplify XCTUnwrap usage with async (#1501)
Because Swift (still?) doesn't have support for "`reasync`", this currently required 2 lines.
2022-04-13 17:29:07 -04:00
NachoSoto 23afeb96d0 Added StoreKit2Setting to replace useStoreKit2IfAvailable (#1467)
This adds a third case `disabled` that allows tests to explicitly disable StoreKit 2.
Some types, like `TrialOrIntroPriceEligibilityChecker` and `TransactionsManager` always used SK2 because the implementation was better. But this meant that tests couldn't explicitly disable it (other than calling the internal methods directly).

This allows #1464 to be a lot simpler but being able to use the public `Purchases` methods, but forcing the implementation to use SK1.

Note that this is purely an implementation detail. `StoreKit2Setting` is `internal`, and the public API still only exposes the same boolean.

This basically solves [CF-497] too, since those tests will now force `TrialOrIntroPriceEligibilityChecker` to run the SK1 implementation.

[CF-497]: https://revenuecats.atlassian.net/browse/CF-497?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2022-04-11 11:41:47 -07:00
aboedo 4d6c7bd5b8 More tests for receipt parsing with storekit test (#1456)
* 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
2022-04-06 15:44:00 -03:00
aboedo 947f47b572 cleaned up test code for receipt parsing (#1457) 2022-04-06 15:43:26 -03:00
aboedo cab0053885 Fix: local receipt parsing for StoreKitTest - part 1 (#1446)
* 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
2022-04-05 16:18:06 -03:00