From 5b2c4191da8c528f9e9e6c5a2218979682913263 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 24 Dec 2021 16:46:42 +0000 Subject: [PATCH] Add about command test --- tests/commands/about.test.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/commands/about.test.ts diff --git a/tests/commands/about.test.ts b/tests/commands/about.test.ts new file mode 100644 index 0000000..0b6e8e8 --- /dev/null +++ b/tests/commands/about.test.ts @@ -0,0 +1,34 @@ +import { Message } from "discord.js"; +import { mock } from "jest-mock-extended"; +import About from "../../src/commands/about"; +import { ICommandContext } from "../../src/contracts/ICommandContext"; +import PublicEmbed from "../../src/helpers/embeds/PublicEmbed"; + +describe('Constructor', () => { + test('Expect values set', () => { + const about = new About(); + + expect(about._category).toBe("General"); + }); +}); + +describe('Execute', () => { + test('Expect embed to be made and sent to the current channel', (done) => { + const message = mock(); + message.channel.send = jest.fn().mockImplementation((embed: PublicEmbed) => { + expect(embed.title).toBe('About'); + expect(embed.description).toBe(''); + + done(); + }); + + const context: ICommandContext = { + name: "about", + args: [], + message: message + }; + + const about = new About(); + about.execute(context); + }); +}); \ No newline at end of file