Skip to content

Add Unity Edit Mode test harness and CI job - #1009

Merged
vegaro merged 1 commit into
mainfrom
cesar/unity-edit-mode-test-infra
Jul 27, 2026
Merged

Add Unity Edit Mode test harness and CI job#1009
vegaro merged 1 commit into
mainfrom
cesar/unity-edit-mode-test-infra

Conversation

@vegaro

@vegaro vegaro commented Jul 24, 2026

Copy link
Copy Markdown
Member

This one's pure harness/CI plumbing, no test content, so it's a small.

Adds the RevenueCat.Tests.EditMode assembly, PurchasesWrapperSpy, and an internal SetWrapper hook (via InternalsVisibleTo) so tests can inject the spy into Purchases. Wires a test-edit-mode CircleCI job that imports the packaged SDK and runs the suite the same way CI already exercises the API tests.

Stacked on top, each independent of the others:


Note

Low Risk
Changes are test/CI infrastructure plus a small internal injection hook on Purchases; no production purchase or auth behavior changes for shipped apps.

Overview
Adds Unity Edit Mode test plumbing so later PRs can assert Purchases behavior against the exported Purchases.unitypackage / PurchasesUI.unitypackage.

Introduces the Editor-only RevenueCat.Tests.EditMode assembly and a PurchasesWrapperSpy that records every IPurchasesWrapper call. Purchases.SetWrapper (internal, exposed via InternalsVisibleTo on the SDK assembly) lets tests inject the spy and keeps AdTracker wired to the same wrapper; platform Start() now goes through SetWrapper instead of assigning _wrapper directly.

CircleCI broadens the pre-import “hide scripts” step to Assets/Tests (.cs and .asmdef), adds a test-edit-mode job (unity/test editmode after import-package), stores JUnit artifacts, and gates the release hold on that job. IntegrationTests README documents running Edit Mode tests locally via Test Runner.

Reviewed by Cursor Bugbot for commit a45f0a2. Bugbot is set up for automated code reviews on this repo. Configure here.

vegaro commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vegaro vegaro added the pr:other Changes to our CI configuration files and scripts label Jul 24, 2026
@vegaro
vegaro force-pushed the cesar/unity-edit-mode-test-infra branch from 75760bd to 3ded913 Compare July 24, 2026 16:03
@vegaro vegaro changed the title test: add Unity Edit Mode test harness and CI job Add Unity Edit Mode test harness and CI job Jul 24, 2026
@vegaro
vegaro marked this pull request as ready for review July 24, 2026 16:06
@vegaro
vegaro requested a review from a team as a code owner July 24, 2026 16:06
Comment thread RevenueCat/Scripts/Purchases.cs Outdated

@rickvdl rickvdl left a comment

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.

Thanks for working on this 🫶 I have no findings other than Facu's comment :)

@vegaro
vegaro force-pushed the cesar/unity-edit-mode-test-infra branch from 3ded913 to 62ef6c4 Compare July 27, 2026 08:57
Comment thread .circleci/config.yml
@vegaro
vegaro force-pushed the cesar/unity-edit-mode-test-infra branch from 62ef6c4 to 98db931 Compare July 27, 2026 09:00
Comment thread IntegrationTests/Assets/Tests/EditMode/PurchasesWrapperSpy.cs Outdated
@vegaro
vegaro force-pushed the cesar/unity-edit-mode-test-infra branch from 98db931 to c91fc0a Compare July 27, 2026 10:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c91fc0a. Configure here.

Comment thread IntegrationTests/Assets/Tests/EditMode/PurchasesWrapperSpy.cs Outdated
Adds the RevenueCat.Tests.EditMode assembly, PurchasesWrapperSpy, and
an internal SetWrapper hook (via InternalsVisibleTo) so tests can
inject a spy wrapper into Purchases. Wires a new CircleCI job that
imports the packaged SDK and runs the Edit Mode suite the same way
CI already exercises the API tests.

Pure harness/CI plumbing, no test content yet. Test coverage lands in
follow-up PRs stacked on this one.
@vegaro
vegaro force-pushed the cesar/unity-edit-mode-test-infra branch from c91fc0a to a45f0a2 Compare July 27, 2026 10:20
@vegaro
vegaro requested a review from facumenzella July 27, 2026 11:36

@facumenzella facumenzella left a comment

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.

LGTM 🙌 nice catch on the params object[] covariance, that one would have been annoying to debug from a failing assert.

@vegaro
vegaro merged commit 558f242 into main Jul 27, 2026
14 checks passed
@vegaro
vegaro deleted the cesar/unity-edit-mode-test-infra branch July 27, 2026 12:03
vegaro added a commit that referenced this pull request Jul 28, 2026
Part of the #1006 split, stacked on #1009.

Adds baseline tests exercising the harness end to end: `Configure`
forwarding through the wrapper spy, configuration builder defaults,
presented-offering-context resolution, and baseline JSON model parsing.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Test-only additions with no runtime SDK changes; low risk aside from
documenting current builder default quirks.
> 
> **Overview**
> Adds **EditMode NUnit tests** under
`IntegrationTests/Assets/Tests/EditMode/` as part of the #1006 split
(stacked on #1009). No production SDK changes—only test coverage and
Unity `.meta` assets.
> 
> **Harness / configure:** `PurchasesCallTests` wires `Purchases` to
`PurchasesWrapperSpy` and asserts `Configure` forwards a fully built
`PurchasesConfiguration` to `IPurchasesWrapper.Setup` with all 14
arguments (including dangerous settings JSON).
> 
> **Configuration builder:** `PurchasesConfigurationTests` locks in
builder defaults vs explicit `Set*` values and null `DangerousSettings`
handling; documents intentional divergences from inspector/docs
(StoreKit version, in-app messages, entitlement verification).
> 
> **Models:** `JsonModelTests` covers `VirtualCurrencies`,
`SubscriptionOption.Price` (large `amountMicros`), and `StoreProduct`
category parsing/fallback. `PresentedOfferingContextTests` covers JSON
round-trip and minimal constructor serialization.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
115d745. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
vegaro added a commit that referenced this pull request Jul 29, 2026
Part of the #1006 split, stacked on #1009.

Adds `WrapperPassthroughTests.cs`: message display, locale override,
cache invalidation, attribute setters, AppsFlyer conversion data, and
Amazon purchase sync forwarding.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Test-only change with no production code modifications; low regression
risk beyond test maintenance.
> 
> **Overview**
> Adds **`WrapperPassthroughTests`** in the IntegrationTests EditMode
suite, following the same `Purchases` + **`PurchasesWrapperSpy`** setup
used by **`PurchasesCallTests`**.
> 
> New NUnit cases assert that public **`Purchases`** APIs delegate to
**`IPurchasesWrapper`** with the expected arguments: JSON serialization
for **`SetAttributes`** (strings and nulls) and
**`SetAppsFlyerConversionData`** (nested maps/lists), reference/null
forwarding for **`ShowInAppMessages`**, string/locale and ID passthrough
(**`OverridePreferredUILocale`**, **`SetAdjustID`**), ordered args for
**`SyncAmazonPurchase`**, boolean forwarding for
**`SetSimulatesAskToBuyInSandbox`**, and no-arg wrapper calls for cache
invalidation and **`CollectDeviceIdentifiers`**. Includes Unity
**`WrapperPassthroughTests.cs.meta`** asset metadata.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3b5a14e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This was referenced Jul 29, 2026
RCGitBot added a commit that referenced this pull request Jul 30, 2026
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* feat(paywalls): Add PaywallListener support to presented paywalls
(SDK-4397) (#1001) via Toni Rico (@tonidero)
### 📦 Dependency Updates
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 18.27.0 (#1026)
via RevenueCat Git Bot (@RCGitBot)
* [Android
10.15.1](https://github.com/RevenueCat/purchases-android/releases/tag/10.15.1)
* [iOS
5.82.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.82.0)
* [iOS
5.81.3](https://github.com/RevenueCat/purchases-ios/releases/tag/5.81.3)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 18.26.0 (#1021)
via RevenueCat Git Bot (@RCGitBot)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 18.25.0 (#1015)
via RevenueCat Git Bot (@RCGitBot)
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 18.24.0 (#1007)
via RevenueCat Git Bot (@RCGitBot)

### 🔄 Other Changes
* Test wrapper pass-through calls (#1010) via Cesar de la Vega (@vegaro)
* Add configuration and harness smoke tests (#1014) via Cesar de la Vega
(@vegaro)
* Add IOSPaywallPresentationStyle.FormSheet for iPad paywall
presentation (#995) via Facundo Menzella (@facumenzella)
* Bump fastlane-plugin-revenuecat_internal from `d392939` to `3421c88`
(#1017) via dependabot[bot] (@dependabot[bot])
* Add Unity Edit Mode test harness and CI job (#1009) via Cesar de la
Vega (@vegaro)
* Use mise lockfile and install-mise-tools in CI (#997) via Álvaro Brey
(@AlvaroBrey)
* Bump json from 2.15.2.1 to 2.19.9 in /IntegrationTests (#1005) via
dependabot[bot] (@dependabot[bot])
* Bump fastlane-plugin-revenuecat_internal from `b52fca5` to `d392939`
(#1004) via dependabot[bot] (@dependabot[bot])

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> The diff only updates version strings and changelogs; no new SDK logic
here. Underlying feature and dependency changes were merged separately
and are documented in CHANGELOG.
> 
> **Overview**
> This PR is an **automatic release** that ships **9.6.0** by bumping
version metadata everywhere it must stay aligned: `.version`,
`RevenueCat/package.json`, `RevenueCatUI/package.json`, `VERSIONS.md`,
and the reported plugin version in `PurchasesWrapper.java` and
`PurchasesUnityHelper.m`.
> 
> The **changelog** for 9.6.0 documents what landed since 9.5.3—not new
code in this diff. Highlights for reviewers: **PaywallListener** on
presented paywalls, **purchases-hybrid-common 18.27.0** (Android
10.15.1, iOS 5.82.0), **FormSheet** iPad paywall presentation style,
plus CI/test harness work (Edit Mode tests, mise lockfile, wrapper
pass-through tests).
> 
> **Risk:** Low for this PR itself—it is versioning and release notes;
runtime behavior changes come from the dependency bumps and features
already merged on the release branch.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d8e79d2. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:other Changes to our CI configuration files and scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants