refactor: update command tests to use require syntax and improve error handling
Deploy to NAS / deploy (push) Successful in 1m4s
Deploy to NAS / deploy (push) Successful in 1m4s
This commit is contained in:
@@ -12,7 +12,8 @@ jest.mock('discord.js', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
const pingCommand = require('../../commands/ping');
|
||||
const PingCommand = require('../../commands/ping').default;
|
||||
const pingCommand = new PingCommand();
|
||||
|
||||
describe('Ping Command', () => {
|
||||
describe('Command Structure', () => {
|
||||
@@ -47,7 +48,7 @@ describe('Ping Command', () => {
|
||||
|
||||
it('should handle interaction reply failure', async () => {
|
||||
// Mock a failed reply
|
||||
interaction.reply.mockRejectedValueOnce(new Error('Failed to reply'));
|
||||
interaction.reply.mockRejectedValue(new Error('Failed to reply'));
|
||||
|
||||
await expect(pingCommand.execute(interaction)).rejects.toThrow(
|
||||
'Failed to reply',
|
||||
|
||||
Reference in New Issue
Block a user