mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
refactor: use eslint-config-neon for packages. (#8579)
Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { REST } from '@discordjs/rest';
|
||||
import { APIGatewayBotInfo, GatewayOpcodes, GatewaySendPayload } from 'discord-api-types/v10';
|
||||
import { MockAgent, Interceptable } from 'undici';
|
||||
import { GatewayOpcodes, type APIGatewayBotInfo, type GatewaySendPayload } from 'discord-api-types/v10';
|
||||
import { MockAgent, type Interceptable } from 'undici';
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { IShardingStrategy, WebSocketManager } from '../../src';
|
||||
import { WebSocketManager, type IShardingStrategy } from '../../src/index.js';
|
||||
|
||||
vi.useFakeTimers();
|
||||
|
||||
@@ -80,7 +80,7 @@ test('fetch gateway information', async () => {
|
||||
})
|
||||
.reply(fetch);
|
||||
|
||||
NOW.mockReturnValue(Infinity);
|
||||
NOW.mockReturnValue(Number.POSITIVE_INFINITY);
|
||||
const cacheExpired = await manager.fetchGatewayInformation();
|
||||
expect(cacheExpired).toEqual(data);
|
||||
expect(fetch).toHaveBeenCalledOnce();
|
||||
@@ -171,8 +171,11 @@ test('it handles passing in both shardIds and shardCount', async () => {
|
||||
test('strategies', async () => {
|
||||
class MockStrategy implements IShardingStrategy {
|
||||
public spawn = vi.fn();
|
||||
|
||||
public connect = vi.fn();
|
||||
|
||||
public destroy = vi.fn();
|
||||
|
||||
public send = vi.fn();
|
||||
}
|
||||
|
||||
@@ -219,6 +222,7 @@ test('strategies', async () => {
|
||||
await manager.destroy(destroyOptions);
|
||||
expect(strategy.destroy).toHaveBeenCalledWith(destroyOptions);
|
||||
|
||||
// eslint-disable-next-line id-length
|
||||
const send: GatewaySendPayload = { op: GatewayOpcodes.RequestGuildMembers, d: { guild_id: '1234', limit: 0 } };
|
||||
await manager.send(0, send);
|
||||
expect(strategy.send).toHaveBeenCalledWith(0, send);
|
||||
|
||||
Reference in New Issue
Block a user