@@ -579,6 +579,54 @@ - (void)testlogPurchaseCommerceEvent {
579579 [mockClient stopMocking ];
580580}
581581
582+ - (void )testlogPurchaseCommerceEventSendingProductName {
583+ MPKitAppboy *kit = [[MPKitAppboy alloc ] init ];
584+ kit.configuration = @{@" bundleCommerceEventData" : @0 ,
585+ @" forwardSkuAsProductName" : @" True" };
586+
587+ BRZConfiguration *configuration = [[BRZConfiguration alloc ] init ];
588+ Braze *testClient = [[Braze alloc ] initWithConfiguration: configuration];
589+ id mockClient = OCMPartialMock (testClient);
590+ [kit setAppboyInstance: mockClient];
591+
592+ XCTAssertEqualObjects (mockClient, [kit appboyInstance ]);
593+
594+ MPProduct *product = [[MPProduct alloc ] initWithName: @" product1" sku: @" 1131331343" quantity: @1 price: @13 ];
595+ product.category = @" category1" ;
596+
597+ MPCommerceEvent *event = [[MPCommerceEvent alloc ] initWithAction: MPCommerceEventActionPurchase product: product];
598+ event.customAttributes = @{@" testKey" : @" testCustomAttValue" };
599+
600+ MPTransactionAttributes *attributes = [[MPTransactionAttributes alloc ] init ];
601+ attributes.transactionId = @" foo-transaction-id" ;
602+ attributes.revenue = @13.00 ;
603+ attributes.tax = @3 ;
604+ attributes.shipping = @3 ;
605+
606+ event.transactionAttributes = attributes;
607+
608+ [[mockClient expect ] logPurchase: @" product1"
609+ currency: @" USD"
610+ price: [@" 13" doubleValue ]
611+ quantity: 1
612+ properties: @{@" Shipping Amount" : @3 ,
613+ @" Total Amount" : @13.00 ,
614+ @" Total Product Amount" : @" 13" ,
615+ @" Tax Amount" : @3 ,
616+ @" Transaction Id" : @" foo-transaction-id" ,
617+ @" Name" : @" product1" ,
618+ @" Category" : @" category1"
619+ }];
620+
621+ MPKitExecStatus *execStatus = [kit logBaseEvent: event];
622+
623+ XCTAssertEqual (execStatus.returnCode , MPKitReturnCodeSuccess);
624+
625+ [mockClient verify ];
626+
627+ [mockClient stopMocking ];
628+ }
629+
582630- (void )testlogPurchaseCommerceEventWithBundledProducts {
583631 MPKitAppboy *kit = [[MPKitAppboy alloc ] init ];
584632 kit.configuration = @{@" bundleCommerceEventData" : @1 };
0 commit comments