refactor: use eslint-config-neon for packages. (#8579)

Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
Suneet Tipirneni
2022-09-01 14:50:16 -04:00
committed by GitHub
parent 4bdb0593ae
commit edadb9fe5d
219 changed files with 2608 additions and 2053 deletions

View File

@@ -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);