@@ -615,6 +615,40 @@ describe('ProductActionType', () => {
615615 expect ( ProductActionType . getExpansionName ( NaN ) ) . toBe ( 'unknown' ) ;
616616 } ) ;
617617 } ) ;
618+
619+ describe ( '#isRoktCommerceType' , ( ) => {
620+ it ( 'returns true for Rokt Brain commerce types (11-18)' , ( ) => {
621+ expect ( ProductActionType . isRoktCommerceType ( ViewCart ) ) . toBe ( true ) ;
622+ expect ( ProductActionType . isRoktCommerceType ( AddShippingInfo ) ) . toBe ( true ) ;
623+ expect ( ProductActionType . isRoktCommerceType ( AddPaymentInfo ) ) . toBe ( true ) ;
624+ expect ( ProductActionType . isRoktCommerceType ( PaymentMethodSelected ) ) . toBe ( true ) ;
625+ expect ( ProductActionType . isRoktCommerceType ( PaymentAttempted ) ) . toBe ( true ) ;
626+ expect ( ProductActionType . isRoktCommerceType ( PaymentSucceeded ) ) . toBe ( true ) ;
627+ expect ( ProductActionType . isRoktCommerceType ( PaymentFailed ) ) . toBe ( true ) ;
628+ expect ( ProductActionType . isRoktCommerceType ( RefundInitiated ) ) . toBe ( true ) ;
629+ } ) ;
630+
631+ it ( 'returns false for standard mParticle commerce types (0-10)' , ( ) => {
632+ expect ( ProductActionType . isRoktCommerceType ( Unknown ) ) . toBe ( false ) ;
633+ expect ( ProductActionType . isRoktCommerceType ( AddToCart ) ) . toBe ( false ) ;
634+ expect ( ProductActionType . isRoktCommerceType ( RemoveFromCart ) ) . toBe ( false ) ;
635+ expect ( ProductActionType . isRoktCommerceType ( Checkout ) ) . toBe ( false ) ;
636+ expect ( ProductActionType . isRoktCommerceType ( CheckoutOption ) ) . toBe ( false ) ;
637+ expect ( ProductActionType . isRoktCommerceType ( Click ) ) . toBe ( false ) ;
638+ expect ( ProductActionType . isRoktCommerceType ( ViewDetail ) ) . toBe ( false ) ;
639+ expect ( ProductActionType . isRoktCommerceType ( Purchase ) ) . toBe ( false ) ;
640+ expect ( ProductActionType . isRoktCommerceType ( Refund ) ) . toBe ( false ) ;
641+ expect ( ProductActionType . isRoktCommerceType ( AddToWishlist ) ) . toBe ( false ) ;
642+ expect ( ProductActionType . isRoktCommerceType ( RemoveFromWishlist ) ) . toBe ( false ) ;
643+ } ) ;
644+
645+ it ( 'returns false for out-of-range values' , ( ) => {
646+ expect ( ProductActionType . isRoktCommerceType ( - 1 ) ) . toBe ( false ) ;
647+ expect ( ProductActionType . isRoktCommerceType ( 19 ) ) . toBe ( false ) ;
648+ expect ( ProductActionType . isRoktCommerceType ( 100 ) ) . toBe ( false ) ;
649+ expect ( ProductActionType . isRoktCommerceType ( NaN ) ) . toBe ( false ) ;
650+ } ) ;
651+ } ) ;
618652} ) ;
619653
620654describe ( 'RoktEvents' , ( ) => {
0 commit comments