From 2cb34de17af5d9fa19d3387ce83912c480ca9752 Mon Sep 17 00:00:00 2001 From: Seweryn Kras Date: Wed, 9 Oct 2024 17:40:31 +0200 Subject: [PATCH] chore: fix ws types in unit test --- src/shared/storage/ws.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shared/storage/ws.test.ts b/src/shared/storage/ws.test.ts index 37f453141..d7e7a0c98 100644 --- a/src/shared/storage/ws.test.ts +++ b/src/shared/storage/ws.test.ts @@ -8,6 +8,7 @@ import { GsbApi, IdentityApi } from "ya-ts-client"; import { anything, imock, instance, mock, reset, verify, when } from "@johanblumenberg/ts-mockito"; import fs, { FileHandle } from "fs/promises"; import { Stats } from "fs"; +import WebSocket from "ws"; jest.mock("uuid", () => ({ v4: () => "uuid" })); jest.mock("fs/promises"); @@ -175,12 +176,12 @@ describe("WebSocketStorageProvider", () => { }); describe("publishFile()", () => { - let socket: WebSocket; + let socket: EventTarget & { send: jest.Mock }; let fileInfo: { id: string; url: string }; let fileHandle: FileHandle; beforeEach(() => { - socket = Object.assign(new EventTarget(), { send: jest.fn() }) as unknown as WebSocket; + socket = Object.assign(new EventTarget(), { send: jest.fn() }); fileInfo = { id: "10", url: "http://localhost:8080", @@ -349,12 +350,12 @@ describe("WebSocketStorageProvider", () => { }); describe("receiveFile()", () => { - let socket: WebSocket; + let socket: EventTarget & { send: jest.Mock }; let fileInfo: { id: string; url: string }; let fileHandle: FileHandle; beforeEach(async () => { - socket = Object.assign(new EventTarget(), { send: jest.fn() }) as unknown as WebSocket; + socket = Object.assign(new EventTarget(), { send: jest.fn() }); fileInfo = { id: "10", url: "http://localhost:8080",