- Add‑on Checkout auf Transactions + Transaction‑ID speichern: app/Services/Addons/EventAddonCheckoutService.php
- Paket/Marketing Checkout auf Transactions: app/Services/Paddle/PaddleCheckoutService.php
- Gift‑Voucher Checkout: Customer anlegen/finden + Transactions: app/Services/GiftVouchers/
GiftVoucherCheckoutService.php
- Tests aktualisiert: tests/Feature/Tenant/EventAddonCheckoutTest.php, tests/Unit/PaddleCheckoutServiceTest.php,
tests/Unit/GiftVoucherCheckoutServiceTest.php
136 lines
3.9 KiB
TypeScript
136 lines
3.9 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { resolveOnboardingRedirect } from './onboardingGuard';
|
|
import {
|
|
ADMIN_WELCOME_BASE_PATH,
|
|
ADMIN_WELCOME_EVENT_PATH,
|
|
ADMIN_WELCOME_SUMMARY_PATH,
|
|
} from '../../constants';
|
|
|
|
describe('resolveOnboardingRedirect', () => {
|
|
it('returns null when events exist', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: true,
|
|
hasActivePackage: false,
|
|
selectedPackageId: null,
|
|
pathname: '/event-admin/mobile/dashboard',
|
|
isWelcomePath: false,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('returns null for welcome paths', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: false,
|
|
selectedPackageId: null,
|
|
pathname: ADMIN_WELCOME_BASE_PATH,
|
|
isWelcomePath: true,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('returns null for billing paths', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: false,
|
|
selectedPackageId: null,
|
|
pathname: '/event-admin/mobile/billing',
|
|
isWelcomePath: false,
|
|
isBillingPath: true,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('redirects to event setup when package active', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: true,
|
|
selectedPackageId: null,
|
|
pathname: '/event-admin/mobile/dashboard',
|
|
isWelcomePath: false,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBe(ADMIN_WELCOME_EVENT_PATH);
|
|
});
|
|
|
|
it('redirects to summary when selection exists', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: false,
|
|
selectedPackageId: 5,
|
|
pathname: '/event-admin/mobile/dashboard',
|
|
isWelcomePath: false,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBe(ADMIN_WELCOME_SUMMARY_PATH);
|
|
});
|
|
|
|
it('redirects to landing when no selection exists', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: false,
|
|
selectedPackageId: null,
|
|
pathname: '/event-admin/mobile/dashboard',
|
|
isWelcomePath: false,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBe(ADMIN_WELCOME_BASE_PATH);
|
|
});
|
|
|
|
it('does not redirect when already on target', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: false,
|
|
selectedPackageId: null,
|
|
pathname: ADMIN_WELCOME_BASE_PATH,
|
|
isWelcomePath: false,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('does not redirect when onboarding is dismissed', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: false,
|
|
selectedPackageId: null,
|
|
pathname: '/event-admin/mobile/dashboard',
|
|
isWelcomePath: false,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: true,
|
|
isOnboardingCompleted: false,
|
|
});
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('does not redirect when onboarding is completed', () => {
|
|
const result = resolveOnboardingRedirect({
|
|
hasEvents: false,
|
|
hasActivePackage: false,
|
|
selectedPackageId: null,
|
|
pathname: '/event-admin/mobile/dashboard',
|
|
isWelcomePath: false,
|
|
isBillingPath: false,
|
|
isOnboardingDismissed: false,
|
|
isOnboardingCompleted: true,
|
|
});
|
|
expect(result).toBeNull();
|
|
});
|
|
});
|