Create list effects command #412
2 changed files with 74 additions and 2 deletions
40
tests/commands/__snapshots__/effects.test.ts.snap
Normal file
40
tests/commands/__snapshots__/effects.test.ts.snap
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`constructor EXPECT CommandBuilder to be defined 1`] = `
|
||||
{
|
||||
"contexts": undefined,
|
||||
"default_member_permissions": undefined,
|
||||
"default_permission": undefined,
|
||||
"description": "Effects",
|
||||
"description_localizations": undefined,
|
||||
"dm_permission": undefined,
|
||||
"integration_types": undefined,
|
||||
"name": "effects",
|
||||
"name_localizations": undefined,
|
||||
"nsfw": undefined,
|
||||
"options": [
|
||||
{
|
||||
"description": "List all effects I have",
|
||||
"description_localizations": undefined,
|
||||
"name": "list",
|
||||
"name_localizations": undefined,
|
||||
"options": [
|
||||
{
|
||||
"autocomplete": undefined,
|
||||
"choices": undefined,
|
||||
"description": "The page number",
|
||||
"description_localizations": undefined,
|
||||
"max_value": undefined,
|
||||
"min_value": 1,
|
||||
"name": "page",
|
||||
"name_localizations": undefined,
|
||||
"required": false,
|
||||
"type": 10,
|
||||
},
|
||||
],
|
||||
"type": 1,
|
||||
},
|
||||
],
|
||||
"type": 1,
|
||||
}
|
||||
`;
|
|
@ -1,10 +1,42 @@
|
|||
import Effects from "../../src/commands/effects";
|
||||
|
||||
describe("constructor", () => {
|
||||
test.todo("EXPECT CommandBuilder to be defined");
|
||||
let effects: Effects;
|
||||
|
||||
beforeEach(() => {
|
||||
effects = new Effects();
|
||||
});
|
||||
|
||||
test("EXPECT CommandBuilder to be defined", () => {
|
||||
expect(effects.CommandBuilder).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("execute", () => {
|
||||
describe("GIVEN interaction is not a chat input command", () => {
|
||||
test.todo("EXPECT nothing to happen");
|
||||
let interaction: any;
|
||||
|
||||
let listSpy: any;
|
||||
|
||||
beforeEach(async () => {
|
||||
interaction = {
|
||||
isChatInputCommand: jest.fn().mockReturnValue(false),
|
||||
};
|
||||
|
||||
const effects = new Effects();
|
||||
|
||||
listSpy = jest.spyOn(effects as any, "List");
|
||||
|
||||
await effects.execute(interaction);
|
||||
});
|
||||
|
||||
test("EXPECT isChatInputCommand to have been called", () => {
|
||||
expect(interaction.isChatInputCommand).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test("EXPECT nothing to happen", () => {
|
||||
expect(listSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("GIVEN subcommand is list", () => {
|
||||
|
|
Loading…
Reference in a new issue