Skip to content

Commit

Permalink
chore: fix ws types in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
SewerynKras committed Oct 9, 2024
1 parent 74b3702 commit 2cb34de
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/shared/storage/ws.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 2cb34de

Please sign in to comment.