- 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.
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import { createHash } from 'node:crypto';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { moduleForCommand } from './module-gates.js';
|
|
|
|
describe('moduleForCommand', () => {
|
|
it('maps moderation commands', () => {
|
|
expect(moduleForCommand('ban')).toBe('moderation');
|
|
expect(moduleForCommand('warn')).toBe('moderation');
|
|
expect(moduleForCommand('case')).toBe('moderation');
|
|
});
|
|
|
|
it('maps redis-only and prisma modules', () => {
|
|
expect(moduleForCommand('giveaway')).toBe('giveaways');
|
|
expect(moduleForCommand('tag')).toBe('tags');
|
|
expect(moduleForCommand('backup')).toBe('guildbackup');
|
|
expect(moduleForCommand('economy' as string)).toBeNull();
|
|
expect(moduleForCommand('balance')).toBe('economy');
|
|
});
|
|
|
|
it('leaves core commands unmapped', () => {
|
|
expect(moduleForCommand('help')).toBeNull();
|
|
expect(moduleForCommand('info')).toBeNull();
|
|
expect(moduleForCommand('about')).toBeNull();
|
|
expect(moduleForCommand('gdpr')).toBeNull();
|
|
});
|
|
});
|
|
|
|
describe('feature flag rollout hashing', () => {
|
|
it('is stable for the same guild/key pair', () => {
|
|
const a = createHash('sha256').update('moderation:guild-1').digest().readUInt32BE(0) % 100;
|
|
const b = createHash('sha256').update('moderation:guild-1').digest().readUInt32BE(0) % 100;
|
|
expect(a).toBe(b);
|
|
});
|
|
});
|