Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide testing utilities #14

Closed
OzairP opened this issue Feb 13, 2018 · 2 comments
Closed

Provide testing utilities #14

OzairP opened this issue Feb 13, 2018 · 2 comments
Labels

Comments

@OzairP
Copy link

OzairP commented Feb 13, 2018

Would be nice if we could mock commands and users so we can unit test our bots.
Possibly expose methods to invoke commands with mocked data.

@1Computer1
Copy link
Member

1Computer1 commented Feb 13, 2018

This is already possible, one such method could be building the modules without logging in then interacting with those modules, e.g.

client.commandHandler.modules.get('roll').exec({
    // Mocks a message object
    send(content) {
        console.log(content);
    }
}, {
  // Mocks args
  faces: 6
});

Another method could be emitting the events you want to test, such as the message event.
If you mean more than this, such as simulating entire guilds and users to work with, then you would have to bring the issue to discord.js.

@OzairP
Copy link
Author

OzairP commented Feb 14, 2018

That's great, thanks. You should add this into the gitbook as well.

@OzairP OzairP closed this as completed Feb 14, 2018
cataclym pushed a commit to cataclym/discord-akairo that referenced this issue Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants