Skip to content

Commit

Permalink
StoreProduct: added test covering warning log (#2897)
Browse files Browse the repository at this point in the history
I saw this log duplicated in our logs. I thought this test would cover
the cause for it, but afterwards realized this only happens in hybrids
because we call this eagerly.
Either way I thought covering this in a test was helpful.
  • Loading branch information
NachoSoto authored Jul 26, 2023
1 parent de5aba3 commit 689e1c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tests/StoreKitUnitTests/StoreProductTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@ class StoreProductTests: StoreKitConfigTestCase {
expect(storeProduct.isFamilyShareable) == isFamilyShareable
}

func testWarningLogWhenGettingSK1ProductType() {
let product = StoreProduct(sk1Product: .init())
self.logger.verifyMessageWasNotLogged(Strings.storeKit.sk1_no_known_product_type)

// Verify warning is only logged when calling method.
expect(product.productType) == .defaultType
self.logger.verifyMessageWasLogged(Strings.storeKit.sk1_no_known_product_type, level: .warn)
}

}

@available(iOS 14.0, tvOS 14.0, macOS 11.0, watchOS 7.0, *)
Expand Down

0 comments on commit 689e1c6

Please sign in to comment.