mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 21:13:30 +01:00
feat: add chatInputApplicationCommandMention formatter (#8546)
feat: add `chatInputApplicationCommandMention()` formatter Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { URL } from 'node:url';
|
||||
import { describe, test, expect, vitest } from 'vitest';
|
||||
import {
|
||||
chatInputApplicationCommandMention,
|
||||
blockQuote,
|
||||
bold,
|
||||
channelLink,
|
||||
@@ -137,6 +138,26 @@ describe('Message formatters', () => {
|
||||
expect(roleMention('815434166602170409')).toEqual('<@&815434166602170409>');
|
||||
});
|
||||
});
|
||||
|
||||
describe('chatInputApplicationCommandMention', () => {
|
||||
test('GIVEN commandName and commandId THEN returns "</[commandName]:[commandId]>"', () => {
|
||||
expect(chatInputApplicationCommandMention('airhorn', '815434166602170409')).toEqual(
|
||||
'</airhorn:815434166602170409>',
|
||||
);
|
||||
});
|
||||
|
||||
test('GIVEN commandName, subcommandName, and commandId THEN returns "</[commandName] [subcommandName]:[commandId]>"', () => {
|
||||
expect(chatInputApplicationCommandMention('airhorn', 'sub', '815434166602170409')).toEqual(
|
||||
'</airhorn sub:815434166602170409>',
|
||||
);
|
||||
});
|
||||
|
||||
test('GIVEN commandName, subcommandGroupName, subcommandName, and commandId THEN returns "</[commandName] [subcommandGroupName] [subcommandName]:[commandId]>"', () => {
|
||||
expect(chatInputApplicationCommandMention('airhorn', 'group', 'sub', '815434166602170409')).toEqual(
|
||||
'</airhorn group sub:815434166602170409>',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatEmoji', () => {
|
||||
|
||||
Reference in New Issue
Block a user