Files
fotospiel-app/resources/js/admin/lib/__tests__/events.test.ts
Codex Agent d4ab9a3a20
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Adjust watermark permissions and transparency
2026-01-19 13:45:43 +01:00

39 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { isBrandingAllowed, isWatermarkAllowed, isWatermarkRemovalAllowed } from '../events';
describe('event branding access helpers', () => {
it('respects package-level disallow', () => {
const event = {
settings: { branding_allowed: true, watermark_allowed: true },
package: { branding_allowed: false, watermark_allowed: false },
};
expect(isBrandingAllowed(event as any)).toBe(false);
expect(isWatermarkAllowed(event as any)).toBe(false);
});
it('uses settings when package allows', () => {
const event = {
settings: { branding_allowed: false, watermark_allowed: true },
package: { branding_allowed: true, watermark_allowed: true },
};
expect(isBrandingAllowed(event as any)).toBe(false);
expect(isWatermarkAllowed(event as any)).toBe(true);
});
it('defaults to allow when nothing is set', () => {
expect(isBrandingAllowed({} as any)).toBe(true);
expect(isWatermarkAllowed({} as any)).toBe(true);
expect(isWatermarkRemovalAllowed({} as any)).toBe(false);
});
it('uses removal flag from settings', () => {
const event = {
settings: { watermark_removal_allowed: true },
};
expect(isWatermarkRemovalAllowed(event as any)).toBe(true);
});
});