Addon-Kauf im Event admin korrigiert.

This commit is contained in:
Codex Agent
2025-12-29 19:31:26 +01:00
parent aaf418a917
commit 902e78cae9
8 changed files with 295 additions and 29 deletions

View File

@@ -0,0 +1,50 @@
import { describe, expect, it } from 'vitest';
import { buildLimitWarnings } from '../limitWarnings';
describe('buildLimitWarnings', () => {
it('renders gallery warning in hours when less than two days remain', () => {
const warnings = buildLimitWarnings(
{
photos: null,
guests: null,
gallery: {
state: 'warning',
expires_at: null,
days_remaining: 1.2,
warning_thresholds: [],
warning_triggered: null,
warning_sent_at: null,
expired_notified_at: null,
},
can_upload_photos: true,
can_add_guests: true,
},
(key, options) => (key === 'galleryWarningHours' ? `hours:${options?.hours}` : key),
);
expect(warnings[0]?.message).toBe('hours:29');
});
it('renders gallery warning in days when two or more days remain', () => {
const warnings = buildLimitWarnings(
{
photos: null,
guests: null,
gallery: {
state: 'warning',
expires_at: null,
days_remaining: 2.1,
warning_thresholds: [],
warning_triggered: null,
warning_sent_at: null,
expired_notified_at: null,
},
can_upload_photos: true,
can_add_guests: true,
},
(key, options) => (key === 'galleryWarningDays' ? `days:${options?.days}` : key),
);
expect(warnings[0]?.message).toBe('days:3');
});
});