-
Notifications
You must be signed in to change notification settings - Fork 54
Expose abandoned transaction product params in filters #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1695,6 +1695,43 @@ struct TrackingTests { | |
| result.parameters.audienceFilterParams["presented_by_event_name"] as? String == paywallInfo.presentedByPlacementWithName) | ||
| } | ||
|
|
||
| @Test func transaction_abandon() async { | ||
| let paywallInfo: PaywallInfo = .stub() | ||
| let productId = "abc" | ||
| let product = StoreProduct( | ||
| sk1Product: MockSkProduct(productIdentifier: productId), | ||
| entitlements: [.stub()] | ||
| ) | ||
| let dependencyContainer = DependencyContainer() | ||
| let skTransaction = MockSKPaymentTransaction(state: .purchased) | ||
| let transaction = await dependencyContainer.makeStoreTransaction(from: skTransaction) | ||
| let result = await Superwall.shared.track( | ||
| InternalSuperwallEvent.Transaction( | ||
| state: .abandon(product), | ||
| paywallInfo: paywallInfo, | ||
| product: product, | ||
| transaction: transaction, | ||
| source: .external, | ||
| isObserved: false, | ||
| storeKitVersion: .storeKit1 | ||
| ) | ||
| ) | ||
|
|
||
| #expect(result.parameters.audienceFilterParams["$event_name"] as! String == "transaction_abandon") | ||
| #expect(result.parameters.audienceFilterParams["$product_period"] != nil) | ||
| #expect(result.parameters.audienceFilterParams["$product_period_months"] != nil) | ||
|
|
||
| #expect( | ||
| result.parameters.audienceFilterParams["event_name"] as! String == "transaction_abandon") | ||
| #expect( | ||
| result.parameters.audienceFilterParams["abandoned_product_id"] as! String == productId) | ||
| #expect(result.parameters.audienceFilterParams["abandoned_product_identifier"] as! String == productId) | ||
| #expect(result.parameters.audienceFilterParams["abandoned_product_period"] != nil) | ||
| #expect(result.parameters.audienceFilterParams["abandoned_product_period_months"] != nil) | ||
| #expect(result.parameters.audienceFilterParams["abandoned_product_period_years"] != nil) | ||
| #expect(result.parameters.audienceFilterParams["abandoned_product_localized_period"] != nil) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt To Fix With AIThis is a comment left during a code review.
Path: Tests/SuperwallKitTests/Analytics/Internal Tracking/TrackTests.swift
Line: 1729-1732
Comment:
**`!= nil` assertions don't verify period values are meaningful**
`periodMonthsString`, `periodYearsString`, etc. return `""` (empty string) for non-subscription products, and an empty string is still non-nil — so these assertions pass even when the feature has not populated real period data. Consider asserting the expected string values from `MockSkProduct`'s configured period, or at least asserting `as? String != ""` to confirm the fields are actually populated.
How can I resolve this? If you propose a fix, please make it concise. |
||
| } | ||
|
|
||
| @Test func transaction_fail() async { | ||
| let paywallInfo: PaywallInfo = .stub() | ||
| let productId = "abc" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.