Addon-Kauf im Event admin korrigiert.
This commit is contained in:
50
resources/js/admin/lib/__tests__/limitWarnings.test.ts
Normal file
50
resources/js/admin/lib/__tests__/limitWarnings.test.ts
Normal 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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user