- Introduced `BotAboutConfig` model for managing the global `/about` message in the owner panel. - Implemented the `/about` command with localization support and integrated it into the help catalog. - Enhanced the dashboard with a new owner section for configuring the `/about` message type and content. - Updated components to handle the new command and its interactions, including support for different message formats (TEXT, EMBED, COMPONENTS_V2). - Added localization entries for the `/about` command in English and German, improving accessibility for users. - Documented the implementation in the phase tracking documentation for future reference.
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
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);
|
|
});
|
|
});
|