Refactor embed handling and enhance user experience across components
- Integrated the new `buildEmbedFromPayload` function in Scheduler, Tags, and Welcome components to streamline embed creation and management. - Updated validation schemas to require embed content checks, ensuring robust data integrity for embeds. - Enhanced localization files to include new placeholder descriptions and improve user guidance for embed fields. - Refactored embed parsing logic to utilize the `WelcomeEmbedSchema`, improving consistency and validation across the application.
This commit is contained in:
@@ -27,6 +27,19 @@ describe('phase2 helpers', () => {
|
||||
expect(result).toBe('Join <#123456789012345678> please');
|
||||
});
|
||||
|
||||
it('accepts extended embed fields', async () => {
|
||||
const { WelcomeEmbedSchema, embedHasContent } = await import('./phase2.js');
|
||||
const parsed = WelcomeEmbedSchema.parse({
|
||||
title: 'Hi',
|
||||
authorName: 'Nexumi',
|
||||
imageUrl: 'https://example.com/banner.png',
|
||||
footerText: 'Nexumi',
|
||||
timestamp: true
|
||||
});
|
||||
expect(parsed.authorName).toBe('Nexumi');
|
||||
expect(embedHasContent(parsed)).toBe(true);
|
||||
});
|
||||
|
||||
it('detects discord invites', () => {
|
||||
expect(isDiscordInvite('join https://discord.gg/test')).toBe(true);
|
||||
expect(isDiscordInvite('hello world')).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user