Feature/12 create tests #102

Merged
Vylpes merged 25 commits from feature/12-create-tests into develop 2022-01-30 17:03:37 +00:00
7 changed files with 2 additions and 64 deletions
Showing only changes of commit 820068bc18 - Show all commits

View file

@ -1,7 +0,0 @@
import { Command } from "../../../src/type/command";
export default class noCategory extends Command {
constructor() {
super();
}
}

View file

@ -1,8 +0,0 @@
import { Command } from "../../../src/type/command";
export default class normal extends Command {
constructor() {
super();
this._category = "General";
}
}

View file

@ -1,8 +0,0 @@
import { Command } from "../../../src/type/command";
export default class roles extends Command {
constructor() {
super();
this._roles = [ "Moderator" ];
}
}

View file

@ -1,5 +0,0 @@
import { Event } from "../../../src/type/event";
export class normal extends Event {
public override channelCreate() {}
}

View file

@ -5,9 +5,7 @@ import * as dotenv from "dotenv";
import { Events } from "../../src/client/events"; import { Events } from "../../src/client/events";
import { Util } from "../../src/client/util"; import { Util } from "../../src/client/util";
import { Command } from "../../src/type/command"; import { Command } from "../../src/type/command";
import ICommandItem from "../../src/contracts/ICommandItem";
import { mock } from "jest-mock-extended"; import { mock } from "jest-mock-extended";
import IEventItem from "../../src/contracts/IEventItem";
import { Event } from "../../src/type/event"; import { Event } from "../../src/type/event";
jest.mock("discord.js"); jest.mock("discord.js");

View file

@ -1,5 +1,5 @@
import { Events } from "../../src/client/events"; import { Events } from "../../src/client/events";
import { Message, Client, TextChannel, Guild, SnowflakeUtil, DMChannel } from "discord.js"; import { Message } from "discord.js";
import { Util } from "../../src/client/util"; import { Util } from "../../src/client/util";
import ICommandItem from "../../src/contracts/ICommandItem"; import ICommandItem from "../../src/contracts/ICommandItem";
import { Command } from "../../src/type/command"; import { Command } from "../../src/type/command";

View file

@ -1,6 +1,6 @@
import { Util } from "../../src/client/util"; import { Util } from "../../src/client/util";
import { Client, Guild, Message, Role, SnowflakeUtil, TextChannel, User } from "discord.js"; import { Client, Message } from "discord.js";
import fs from "fs"; import fs from "fs";
import { mock } from "jest-mock-extended"; import { mock } from "jest-mock-extended";
import { Command } from "../../src/type/command"; import { Command } from "../../src/type/command";
@ -23,9 +23,6 @@ describe('LoadCommand', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
roles: { roles: {
@ -62,9 +59,6 @@ describe('LoadCommand', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: null member: null
} as unknown as Message; } as unknown as Message;
@ -95,9 +89,6 @@ describe('LoadCommand', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
roles: { roles: {
@ -134,9 +125,6 @@ describe('LoadCommand', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
roles: { roles: {
@ -177,9 +165,6 @@ describe('LoadCommand', () => {
COMMANDS_DISABLED_MESSAGE: 'disabled', COMMANDS_DISABLED_MESSAGE: 'disabled',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
roles: { roles: {
@ -221,9 +206,6 @@ describe('LoadCommand', () => {
COMMANDS_DISABLED: 'test', COMMANDS_DISABLED: 'test',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
roles: { roles: {
@ -265,9 +247,6 @@ describe('LoadCommand', () => {
COMMANDS_DISABLED: 'other', COMMANDS_DISABLED: 'other',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
roles: { roles: {
@ -311,9 +290,6 @@ describe('LoadCommand', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
const message = { const message = {
member: { member: {
roles: { roles: {
@ -346,10 +322,6 @@ describe('LoadEvents', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
fs.readdirSync = jest.fn().mockReturnValue(["normal.ts"]);
const client = { const client = {
on: jest.fn(), on: jest.fn(),
} as unknown as Client; } as unknown as Client;
@ -380,10 +352,6 @@ describe('LoadEvents', () => {
FOLDERS_EVENTS: 'events', FOLDERS_EVENTS: 'events',
} }
process.cwd = jest.fn().mockReturnValue("../../tests/__mocks");
fs.existsSync = jest.fn().mockReturnValue(true);
fs.readdirSync = jest.fn().mockReturnValue(["normal"]);
const client = { const client = {
on: jest.fn(), on: jest.fn(),
} as unknown as Client; } as unknown as Client;