@@ -260,6 +260,41 @@ void main() {
260
260
expect (lastPurchaseOptions.winBackOfferId, isNull);
261
261
expect (lastPurchaseOptions.promotionalOffer, isNull);
262
262
});
263
+
264
+ test ('should pass quantity for consumable product with Sk2PurchaseParam' ,
265
+ () async {
266
+ final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam (
267
+ productDetails:
268
+ AppStoreProduct2Details .fromSK2Product (dummyProductWrapper),
269
+ quantity: 3 ,
270
+ applicationUserName: 'testUser' ,
271
+ );
272
+
273
+ await iapStoreKitPlatform.buyConsumable (purchaseParam: purchaseParam);
274
+
275
+ final SK2ProductPurchaseOptionsMessage lastPurchaseOptions =
276
+ fakeStoreKit2Platform.lastPurchaseOptions! ;
277
+
278
+ expect (lastPurchaseOptions.appAccountToken, 'testUser' );
279
+ expect (lastPurchaseOptions.quantity, 3 );
280
+ expect (lastPurchaseOptions.winBackOfferId, isNull);
281
+ expect (lastPurchaseOptions.promotionalOffer, isNull);
282
+ });
283
+ test ('should default to quantity = 1 when not provided in Sk2PurchaseParam' ,
284
+ () async {
285
+ final Sk2PurchaseParam purchaseParam = Sk2PurchaseParam (
286
+ productDetails:
287
+ AppStoreProduct2Details .fromSK2Product (dummyProductWrapper),
288
+ applicationUserName: 'testUser' ,
289
+ );
290
+
291
+ await iapStoreKitPlatform.buyConsumable (purchaseParam: purchaseParam);
292
+
293
+ final SK2ProductPurchaseOptionsMessage lastPurchaseOptions =
294
+ fakeStoreKit2Platform.lastPurchaseOptions! ;
295
+
296
+ expect (lastPurchaseOptions.quantity, 1 );
297
+ });
263
298
});
264
299
265
300
group ('restore purchases' , () {
0 commit comments