(content = '!ban')
| 10 | const warnData = warnCommand.default?.data || warnCommand.data || warnCommand; |
| 11 | |
| 12 | function createMockMessage(content = '!ban') { |
| 13 | const sentMessages = []; |
| 14 | |
| 15 | const channel = { |
| 16 | send: async (payload) => { |
| 17 | sentMessages.push(payload); |
| 18 | return { |
| 19 | id: `msg-${sentMessages.length}`, |
| 20 | edit: async (editPayload) => { |
| 21 | sentMessages[sentMessages.length - 1] = editPayload; |
| 22 | return sentMessages[sentMessages.length - 1]; |
| 23 | }, |
| 24 | deletable: true, |
| 25 | delete: async () => {}, |
| 26 | }; |
| 27 | }, |
| 28 | }; |
| 29 | |
| 30 | const message = { |
| 31 | id: 'trigger-msg', |
| 32 | content, |
| 33 | author: { id: 'user-1', tag: 'User#0001', bot: false, toString: () => '<@user-1>' }, |
| 34 | member: { permissions: { has: () => true } }, |
| 35 | guild: { id: 'guild-1', members: { cache: new Map(), fetch: async () => null } }, |
| 36 | channel, |
| 37 | client: { config: { bot: { prefix: '!' } } }, |
| 38 | createdTimestamp: Date.now(), |
| 39 | createdAt: new Date(), |
| 40 | deletable: false, |
| 41 | }; |
| 42 | |
| 43 | return { message, sentMessages, channel }; |
| 44 | } |
| 45 | |
| 46 | test('buildPrefixUsage formats empty ban command args', () => { |
| 47 | const options = { subcommandName: null, subcommandGroupName: null, optionDefs: banData.options.map((opt) => ({ name: opt.name, required: opt.required })) }; |
no outgoing calls
no test coverage detected