File tree Expand file tree Collapse file tree
extensions/discord/src/voice Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -231,17 +231,35 @@ vi.mock("../runtime.js", () => ({
231231
232232let managerModule : typeof import ( "./manager.js" ) ;
233233
234+ function createVoiceChannelInfo (
235+ channelId : string ,
236+ guildId = "g1" ,
237+ guildName = "Guild One" ,
238+ ) : {
239+ id : string ;
240+ guildId : string ;
241+ guild : { id : string ; name : string } ;
242+ type : ChannelType ;
243+ } {
244+ return {
245+ id : channelId ,
246+ guildId,
247+ guild : { id : guildId , name : guildName } ,
248+ type : ChannelType . GuildVoice ,
249+ } ;
250+ }
251+
252+ type VoiceChannelInfo = ReturnType < typeof createVoiceChannelInfo > ;
253+
234254function createClient ( ) {
235255 return {
236256 rest : {
237257 get : vi . fn ( ) ,
238258 } ,
239- fetchChannel : vi . fn ( async ( channelId : string ) => ( {
240- id : channelId ,
241- guildId : "g1" ,
242- guild : { id : "g1" , name : "Guild One" } ,
243- type : ChannelType . GuildVoice ,
244- } ) ) ,
259+ fetchChannel : vi . fn (
260+ async ( channelId : string ) : Promise < VoiceChannelInfo | null > =>
261+ createVoiceChannelInfo ( channelId ) ,
262+ ) ,
245263 fetchGuild : vi . fn ( async ( guildId : string ) => ( {
246264 id : guildId ,
247265 name : "Guild One" ,
You can’t perform that action at this time.
0 commit comments