import { describe, expect, it } from 'vitest'; import { BotPresenceConfigSchema, FeatureFlagUpsertSchema, ownerRoleAtLeast, OwnerTeamUpsertSchema } from './owner.js'; describe('owner schemas', () => { it('parses presence config', () => { const parsed = BotPresenceConfigSchema.parse({ status: 'online', activityType: 'Playing', activityText: 'nexumi.de', rotatingMessages: ['a', 'b'], maintenanceMode: false, maintenanceMessage: null }); expect(parsed.activityText).toBe('nexumi.de'); }); it('ranks owner roles', () => { expect(ownerRoleAtLeast('ADMIN', 'SUPPORT')).toBe(true); expect(ownerRoleAtLeast('VIEWER', 'ADMIN')).toBe(false); }); it('validates team and flags', () => { expect( OwnerTeamUpsertSchema.parse({ userId: '123456789012345678', role: 'SUPPORT', note: null }).role ).toBe('SUPPORT'); expect( FeatureFlagUpsertSchema.parse({ key: 'new.module', enabled: true, rolloutPercent: 10, whitelistGuildIds: [] }).rolloutPercent ).toBe(10); }); });