- Integrated new command modules for managing giveaways, tickets, self-roles, tags, starboard, suggestions, and birthdays, enhancing the bot's capabilities. - Implemented job handling for giveaway endings, ticket management, and birthday role expirations, improving automation and user experience. - Updated command definitions and interaction handling to support new features, ensuring smooth user interactions. - Enhanced the job processing system with dedicated workers for managing various tasks, including auto-closing tickets and running birthday checks. - Documented the new features and their setup processes in PHASE-TRACKING.md for clarity on implementation steps.
21 lines
638 B
TypeScript
21 lines
638 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { applyTagPlaceholders, escapeHtml, pickRandomWinners } from './phase4.js';
|
|
|
|
describe('phase4 helpers', () => {
|
|
it('picks unique random winners', () => {
|
|
const winners = pickRandomWinners([1, 2, 3, 4, 5], 3);
|
|
expect(winners).toHaveLength(3);
|
|
expect(new Set(winners).size).toBe(3);
|
|
});
|
|
|
|
it('applies tag placeholders', () => {
|
|
expect(applyTagPlaceholders('Hi {user} on {server}', { user: '<@1>', server: 'Nexumi' })).toBe(
|
|
'Hi <@1> on Nexumi'
|
|
);
|
|
});
|
|
|
|
it('escapes html', () => {
|
|
expect(escapeHtml('<b>&"')).toBe('<b>&"');
|
|
});
|
|
});
|