Skip to content

Integration Tests: ensure that environment is sandbox#1730

Merged
NachoSoto merged 1 commit into
mainfrom
integration-tests-sandbox
Jun 22, 2022
Merged

Integration Tests: ensure that environment is sandbox#1730
NachoSoto merged 1 commit into
mainfrom
integration-tests-sandbox

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

For some reason the url is [app_bundle]/StoreKit/receipt in integration tests.
This is not correct, so I've added a couple of tests: one for entitlements, and another one to check the raw output value of that property.

This is necessary to make sure that receipts are loaded correctly after #1726.

@NachoSoto NachoSoto requested a review from a team June 22, 2022 18:20
@NachoSoto NachoSoto force-pushed the integration-tests-sandbox branch from f50c690 to da559e1 Compare June 22, 2022 18:21
For some reason the url is `[app_bundle]/StoreKit/receipt` in integration tests.
This is not correct, so I've added a couple of tests: one for entitlements, and another one to check the raw output value of that property.

This is necessary to make sure that receipts are loaded correctly after #1726.
@NachoSoto NachoSoto force-pushed the integration-tests-sandbox branch from da559e1 to 9f96300 Compare June 22, 2022 18:23
Comment on lines +41 to +44
// Mutable in tests so it can be overriden
static var `default`: SandboxEnvironmentDetector = BundleSandboxEnvironmentDetector()
#else
static let `default`: SandboxEnvironmentDetector = BundleSandboxEnvironmentDetector()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

var vs let here is clever! FWIW just having it be internal would likely have been enough for testing purposes, but this adds extra safety

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exactly my thought :)

return .disabled
}

func testIsSandbox() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved this here so it runs in SK1 and SK2 separately, in case that logic ever diverges (like in iOS 16 potentially?)

@NachoSoto NachoSoto merged commit 86a3cab into main Jun 22, 2022
@NachoSoto NachoSoto deleted the integration-tests-sandbox branch June 22, 2022 18:39
NachoSoto added a commit that referenced this pull request Feb 9, 2023
… on simulator

Thanks to @chrisvasselli for the find and initial implementation.
This supersedes the workaround introduced in #1730, now making `IntegrationTests` not override the `SandboxEnvironmentDetector`.
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.

2 participants