added dash to commands.js and test to pass

This commit is contained in:
Aster Fialla
2026-02-24 18:48:59 -05:00
parent 664295e4a5
commit ad783ae6b7
2 changed files with 13 additions and 7 deletions

View File

@@ -45,8 +45,12 @@ cmds.memberCommand = async function(message, args) {
await message.reply({embeds: [reply]})
}
else if (typeof reply === 'object') {
const errorsText = reply.errors.length > 0 ? reply.errors.join('\n- ') : null;
return await message.reply({content: `${reply.success} ${errorsText ? `\n\n${enums.err.ERRORS_OCCURRED}\n` + errorsText : ""}`, embeds: [reply.embed]})
// The little dash is so that the errors print out in bullet points in Fluxer
const errorsText = reply.errors.length > 0 ? '- ' + reply.errors.join('\n- ') : null;
return await message.reply({
content: `${reply.success} ${errorsText ? `\n\n${enums.err.ERRORS_OCCURRED}\n` + errorsText : ""}`,
embeds: [reply.embed]
})
}
}

View File

@@ -107,17 +107,19 @@ describe('commands', () => {
const reply = {
errors: ['error', 'error2'],
success: 'success',
embed: {}
embed: {title: 'hi'}
}
const expected = {
content: `success \n\n${enums.err.ERRORS_OCCURRED}\n- error\n- error2`,
embeds: [reply.embed]
}
console.log(expected)
memberHelper.parseMemberCommand = jest.fn().mockResolvedValue(reply);
// Act
await commands.memberCommand(message, args);
// Assert
expect(message.reply).toHaveBeenCalledTimes(1);
expect(message.reply).toHaveBeenCalledWith({
content: `success\n\n${enums.err.ERRORS_OCCURRED}\n\nerror\nerror2`,
embeds: [reply.embed]
})
expect(message.reply).toHaveBeenCalledWith(expected)
})
describe('importCommand', () => {