1- import { Client , TextChannel } from "discord.js" ;
2- import { Player , Shoukaku } from "shoukaku" ;
1+ import { Client } from "discord.js" ;
2+ import { Shoukaku } from "shoukaku" ;
33import { Laurentina } from "../src" ;
44
5- // Mocks
6- // const mockGuildID = '1234567890';
7- // const mockChannelID = '0987654321';
8- // const mockTextChannel = {} as TextChannel;
9- // const mockPlayer = {} as Player;
5+ const mockGuildID = '1234567890' ;
6+ const mockChannelID = '0987654321' ;
7+ const mockTextChannel = '1234567890'
108
11- interface CustomClient extends Client {
12- shoukaku : Shoukaku ;
13- laurentina : Laurentina ;
9+ declare module "discord.js" {
10+ interface Client {
11+ laurentina : Laurentina ;
12+ shoukaku : Shoukaku ;
13+ }
1414}
1515
16- const client = { } as CustomClient ;
17- const mockShoukaku = { } as Shoukaku ;
16+ const client = { } as Client ;
1817const mockLavalinkNodes = { } as { name : string ; url : string ; auth : string } [ ] ;
18+ const mockShoukaku = { } as Shoukaku ;
1919
20- const laurentina = new Laurentina ( client , mockShoukaku , mockLavalinkNodes ) ;
20+ const laurentina = new Laurentina ( mockShoukaku , mockLavalinkNodes ) ;
2121
2222client . shoukaku = mockShoukaku ;
2323client . laurentina = laurentina ;
@@ -28,14 +28,19 @@ describe("Laurentina", () => {
2828 } ) ;
2929
3030 it ( "should be an instance of Laurentina" , ( ) => {
31- expect ( laurentina ) . toBeInstanceOf ( Laurentina ) ;
31+ expect ( client . laurentina ) . toBeInstanceOf ( Laurentina ) ;
32+ } ) ;
33+
34+ it ( "should have a property 'shoukaku'" , ( ) => {
35+ expect ( client . laurentina . shoukaku ) . toBe ( mockShoukaku ) ;
3236 } ) ;
3337
34- it ( "should have a property 'client' " , ( ) => {
35- expect ( laurentina . client ) . toBe ( client ) ;
38+ it ( "should return 'false' if the guild ID for 'removeController' is not found " , ( ) => {
39+ expect ( client . laurentina . removeController ( mockGuildID ) ) . toBeFalsy ( ) ;
3640 } ) ;
3741
38- it ( "should have a property 'shoukaku'" , ( ) => {
39- expect ( laurentina . shoukaku ) . toBe ( mockShoukaku ) ;
42+ it ( "should return 'undefined' if the guild ID for 'AudioController' is not found" , ( ) => {
43+ const audioController = laurentina . getController ( mockGuildID ) ;
44+ expect ( audioController ) . toBeUndefined ( ) ;
4045 } ) ;
4146} ) ;
0 commit comments