Refine branding labels and access checks

This commit is contained in:
Codex Agent
2026-01-15 08:51:06 +01:00
parent b0ba29fcb6
commit 2b187e7864
5 changed files with 66 additions and 16 deletions

View File

@@ -0,0 +1,29 @@
import { describe, expect, it } from 'vitest';
import { isBrandingAllowed, isWatermarkAllowed } 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);
});
});