Tests and CI #44
|
@ -1,3 +1,5 @@
|
|||
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
|
||||
module.exports = {
|
||||
testEnvironment: 'node'
|
||||
}
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
};
|
|
@ -25,7 +25,10 @@
|
|||
],
|
||||
"repository": "github:vylpes/vylbot-core",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/node": "^16.3.2",
|
||||
"jest": "^27.0.6",
|
||||
"ts-jest": "^27.0.4",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
|
|
135
tests/client/client.test.ts
Normal file
|
@ -0,0 +1,135 @@
|
|||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
import { CoreClient } from "../../src/client/client";
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
import { Client } from "discord.js";
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
import * as dotenv from "dotenv";
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
import { Events } from "../../src/client/events";
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
import { Util } from "../../src/client/util";
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
jest.mock("discord.js");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
jest.mock("dotenv");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
jest.mock("../../src/client/events");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
jest.mock("../../src/client/util");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Constructor_ExpectSuccessfulInitialisation', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(coreClient).toBeInstanceOf(Client);
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(dotenv.config).toBeCalledTimes(1);
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(Events).toBeCalledTimes(1);
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(Util).toBeCalledTimes(1);
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenEnvIsValid_ExpectSuccessfulStart', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: 'TOKEN',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '!',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: 'commands',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: 'events',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).not.toThrow();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(coreClient.on).toBeCalledWith("message", expect.any(Function));
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(coreClient.on).toBeCalledWith("ready", expect.any(Function));
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenBotTokenIsNull_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '!',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: 'commands',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: 'events',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("BOT_TOKEN is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenBotTokenIsEmpty_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: '',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '!',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: 'commands',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: 'events',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("BOT_TOKEN is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenBotPrefixIsNull_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: 'TOKEN',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: 'commands',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: 'events',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("BOT_PREFIX is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenBotPrefixIsEmpty_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: 'TOKEN',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: 'commands',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: 'events',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("BOT_PREFIX is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenFoldersCommandsIsNull_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: 'TOKEN',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '!',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: 'events',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("FOLDERS_COMMANDS is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenFoldersCommandsIsEmpty_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: 'TOKEN',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '!',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: '',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: 'events',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("FOLDERS_COMMANDS is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenFoldersEventsIsNull_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: 'TOKEN',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '!',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: 'commands',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("FOLDERS_EVENTS is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
test('Start_GivenFoldersCommandsIsEmpty_ExpectFailure', () => {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
process.env = {
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_TOKEN: 'TOKEN',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
BOT_PREFIX: '!',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_COMMANDS: 'commands',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
FOLDERS_EVENTS: '',
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
}
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
const coreClient = new CoreClient();
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
expect(() => coreClient.start()).toThrow("FOLDERS_EVENTS is not defined in .env");
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
||||
});
|
||||
Should these be put into a describe group? Should these be put into a describe group?
This would apply to all other tests also This would apply to all other tests also
|
|
@ -71,5 +71,8 @@
|
|||
},
|
||||
"include": [
|
||||
"./src",
|
||||
],
|
||||
"exclude": [
|
||||
"./tests"
|
||||
]
|
||||
}
|
||||
|
|
Should these be put into a describe group?
This would apply to all other tests also