🧪 Add failing tests for new onboarding flags

This commit is contained in:
Philipp Stracker 2025-02-27 19:00:57 +01:00
parent 13ba22f849
commit d48b11a75e
No known key found for this signature in database

View file

@ -1,5 +1,6 @@
import '@testing-library/jest-dom';
import { PRODUCT_TYPES } from './configuration';
import { determineProductsAndCaps } from './selectors';
describe( 'determineProductsAndCaps selector [casual seller]', () => {
@ -15,7 +16,7 @@ describe( 'determineProductsAndCaps selector [casual seller]', () => {
},
expected: {
products: [ 'EXPRESS_CHECKOUT' ],
options: {},
options: { useSubscriptions: false },
},
},
{
@ -29,7 +30,7 @@ describe( 'determineProductsAndCaps selector [casual seller]', () => {
},
expected: {
products: [ 'EXPRESS_CHECKOUT' ],
options: {},
options: { useSubscriptions: false },
},
},
{
@ -43,7 +44,7 @@ describe( 'determineProductsAndCaps selector [casual seller]', () => {
},
expected: {
products: [ 'EXPRESS_CHECKOUT' ],
options: {},
options: { useSubscriptions: false },
},
},
{
@ -57,7 +58,22 @@ describe( 'determineProductsAndCaps selector [casual seller]', () => {
},
expected: {
products: [ 'EXPRESS_CHECKOUT', 'ADVANCED_VAULTING' ],
options: {},
options: { useSubscriptions: false },
},
},
{
name: 'should ignore SUBSCRIPTION product for casual sellers',
state: {
data: {
isCasualSeller: true,
areOptionalPaymentMethodsEnabled: true,
products: [ PRODUCT_TYPES.SUBSCRIPTIONS ],
},
flags: { canUseCardPayments: false, canUseVaulting: true },
},
expected: {
products: [ 'EXPRESS_CHECKOUT', 'ADVANCED_VAULTING' ],
options: { useSubscriptions: false },
},
},
];
@ -81,7 +97,7 @@ describe( 'determineProductsAndCaps selector [business seller]', () => {
},
expected: {
products: [ 'EXPRESS_CHECKOUT' ],
options: {},
options: { useSubscriptions: false },
},
},
{
@ -95,7 +111,7 @@ describe( 'determineProductsAndCaps selector [business seller]', () => {
},
expected: {
products: [ 'EXPRESS_CHECKOUT' ],
options: {},
options: { useSubscriptions: false },
},
},
{
@ -109,7 +125,7 @@ describe( 'determineProductsAndCaps selector [business seller]', () => {
},
expected: {
products: [ 'PPCP' ],
options: {},
options: { useSubscriptions: false },
},
},
{
@ -123,7 +139,7 @@ describe( 'determineProductsAndCaps selector [business seller]', () => {
},
expected: {
products: [ 'PPCP', 'ADVANCED_VAULTING' ],
options: {},
options: { useSubscriptions: false },
},
},
{
@ -132,12 +148,28 @@ describe( 'determineProductsAndCaps selector [business seller]', () => {
data: {
isCasualSeller: false,
areOptionalPaymentMethodsEnabled: true,
products: [ PRODUCT_TYPES.VIRTUAL ],
},
flags: { canUseCardPayments: false, canUseVaulting: true },
},
expected: {
products: [ 'EXPRESS_CHECKOUT', 'ADVANCED_VAULTING' ],
options: {},
options: { useSubscriptions: false },
},
},
{
name: 'should enable the SUBSCRIPTIONS option when a business seller selects the subscriptions-product',
state: {
data: {
isCasualSeller: false,
areOptionalPaymentMethodsEnabled: true,
products: [ PRODUCT_TYPES.SUBSCRIPTIONS ],
},
flags: { canUseCardPayments: true, canUseVaulting: true },
},
expected: {
products: [ 'PPCP', 'ADVANCED_VAULTING' ],
options: { useSubscriptions: true },
},
},
];