mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
feat: fetch gateway information without requiring rest in ws (#10651)
* feat: overridable initial gateway URL * chore: discussion changes * chore: requested change * chore: other changes * Update packages/ws/src/ws/WebSocketManager.ts * style: run ESLint --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
/* eslint-disable id-length */
|
||||
import { setImmediate } from 'node:timers';
|
||||
import { REST } from '@discordjs/rest';
|
||||
import {
|
||||
GatewayDispatchEvents,
|
||||
GatewayOpcodes,
|
||||
type GatewayDispatchPayload,
|
||||
type GatewaySendPayload,
|
||||
} from 'discord-api-types/v10';
|
||||
import type { RESTGetAPIGatewayBotResult, GatewayDispatchPayload, GatewaySendPayload } from 'discord-api-types/v10';
|
||||
import { GatewayDispatchEvents, GatewayOpcodes, Routes } from 'discord-api-types/v10';
|
||||
import { MockAgent, type Interceptable } from 'undici';
|
||||
import { beforeEach, test, vi, expect, afterEach } from 'vitest';
|
||||
import {
|
||||
@@ -159,7 +155,9 @@ test('spawn, connect, send a message, session info, and destroy', async () => {
|
||||
const manager = new WebSocketManager({
|
||||
token: 'A-Very-Fake-Token',
|
||||
intents: 0,
|
||||
rest,
|
||||
async fetchGatewayInformation() {
|
||||
return rest.get(Routes.gatewayBot()) as Promise<RESTGetAPIGatewayBotResult>;
|
||||
},
|
||||
shardIds: [0, 1],
|
||||
retrieveSessionInfo: mockRetrieveSessionInfo,
|
||||
updateSessionInfo: mockUpdateSessionInfo,
|
||||
|
||||
Reference in New Issue
Block a user