removed the old event admin components and pages

This commit is contained in:
Codex Agent
2025-12-12 13:38:06 +01:00
parent bbf8d4a0f4
commit 1719d96fed
85 changed files with 994 additions and 19981 deletions

View File

@@ -0,0 +1,26 @@
import { describe, expect, it } from 'vitest';
import { selectAddonKeyForScope } from '../addons';
import type { EventAddonCatalogItem } from '../../api';
const sampleAddons: EventAddonCatalogItem[] = [
{ key: 'extra_photos_500', label: '500 photos', price_id: 'price_1' },
{ key: 'extend_gallery_30d', label: '30 days', price_id: 'price_2' },
{ key: 'custom_photos', label: 'Custom photos', price_id: 'price_3' },
];
describe('selectAddonKeyForScope', () => {
it('prefers scoped default with price id', () => {
expect(selectAddonKeyForScope(sampleAddons, 'photos')).toBe('extra_photos_500');
expect(selectAddonKeyForScope(sampleAddons, 'gallery')).toBe('extend_gallery_30d');
});
it('falls back to first scoped addon when defaults missing', () => {
const addons: EventAddonCatalogItem[] = [{ key: 'custom_gallery', label: 'Gallery', price_id: 'price_9' }];
expect(selectAddonKeyForScope(addons, 'gallery')).toBe('custom_gallery');
});
it('returns fallback key when no priced addons exist', () => {
const addons: EventAddonCatalogItem[] = [{ key: 'extra_photos_500', label: '500 photos', price_id: null }];
expect(selectAddonKeyForScope(addons, 'photos')).toBe('extra_photos_500');
});
});

View File

@@ -0,0 +1,21 @@
import { describe, expect, it } from 'vitest';
import { isPastEvent } from '../eventDate';
describe('isPastEvent', () => {
it('detects past dates', () => {
const past = new Date();
past.setDate(past.getDate() - 2);
expect(isPastEvent(past.toISOString())).toBe(true);
});
it('detects future dates', () => {
const future = new Date();
future.setDate(future.getDate() + 2);
expect(isPastEvent(future.toISOString())).toBe(false);
});
it('handles invalid input', () => {
expect(isPastEvent(undefined)).toBe(false);
expect(isPastEvent('not-a-date')).toBe(false);
});
});

View File

@@ -1,7 +1,6 @@
import { describe, it, expect } from 'vitest';
import type { EventQrInviteLayout } from '../../api';
import { buildInitialTextFields } from '../QrLayoutCustomizePage';
import { resolveLayoutForFormat } from '../QrPrintPage';
import { buildInitialTextFields, resolveLayoutForFormat } from '../qr/utils';
describe('buildInitialTextFields', () => {
it('prefers event name for headline and default copy when customization is missing', () => {
@@ -18,7 +17,7 @@ describe('buildInitialTextFields', () => {
});
expect(fields.headline).toBe('Sommerfest 2025');
expect(fields.description).toBe('Helft uns, diesen besonderen Tag mit euren schönen Momenten festzuhalten.');
expect(fields.description).toBe('Old description');
expect(fields.instructions).toHaveLength(3);
});