- Introduced the Owner Panel with new routes and UI components for managing guilds, user blacklists, feature flags, and bot presence. - Added maintenance mode functionality to prevent non-owner users from executing commands during maintenance periods. - Enhanced localization with new keys for Owner Panel features in both English and German. - Updated job processing to include a presence refresh job, ensuring the bot's status is regularly updated. - Improved environment configuration to support owner user IDs for access control.
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
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);
|
|
});
|
|
});
|