import { describe, expect, it } from 'vitest'; import { BotAboutConfigSchema, 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('parses about config', () => { const parsed = BotAboutConfigSchema.parse({ enabled: true, messageType: 'EMBED', content: null, embed: { title: 'About', description: 'Nexumi', color: 0x6366f1 }, components: null }); expect(parsed.embed?.title).toBe('About'); }); 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); }); });