test: fix type errors (#11325)

* test: fix type errors

* chore: use MockedFunction

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida
2025-12-08 00:24:29 +00:00
committed by GitHub
parent 8d33188ac1
commit 5888663392
12 changed files with 68 additions and 78 deletions

View File

@@ -1,6 +1,4 @@
/* eslint-disable @typescript-eslint/consistent-type-imports */
// @ts-nocheck
import { beforeEach, test, vi, expect } from 'vitest';
import { test, vi, expect } from 'vitest';
import {
managerToFetchingStrategyOptions,
WorkerContextFetchingStrategy,
@@ -9,17 +7,20 @@ import {
WorkerReceivePayloadOp,
type WorkerReceivePayload,
type WorkerSendPayload,
type SessionInfo,
} from '../../src/index.js';
import { mockGatewayInformation } from '../gateway.mock.js';
const session = {
const session: SessionInfo = {
shardId: 0,
shardCount: 1,
sequence: 123,
sessionId: 'abc',
resumeURL: 'wss://resume.url/',
};
vi.mock('node:worker_threads', async () => {
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
const { EventEmitter }: typeof import('node:events') = await vi.importActual('node:events');
class MockParentPort extends EventEmitter {
public postMessage(message: WorkerReceivePayload) {