diff --git a/apps/server/src/modules/tldraw/controller/api-test/tldraw.ws.api.spec.ts b/apps/server/src/modules/tldraw/controller/api-test/tldraw.ws.api.spec.ts index 9c27beffb3e..55b8b27123c 100644 --- a/apps/server/src/modules/tldraw/controller/api-test/tldraw.ws.api.spec.ts +++ b/apps/server/src/modules/tldraw/controller/api-test/tldraw.ws.api.spec.ts @@ -160,7 +160,7 @@ describe('WebSocketController (WsAdapter)', () => { expect(wsCloseSpy).toHaveBeenCalledWith( WsCloseCodeEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_CODE, - WsCloseMessageEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_MESSAGE + Buffer.from(WsCloseMessageEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_MESSAGE) ); httpGetCallSpy.mockRestore(); @@ -177,7 +177,7 @@ describe('WebSocketController (WsAdapter)', () => { expect(wsCloseSpy).toHaveBeenCalledWith( WsCloseCodeEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_CODE, - WsCloseMessageEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_MESSAGE + Buffer.from(WsCloseMessageEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_MESSAGE) ); httpGetCallSpy.mockRestore(); @@ -206,7 +206,7 @@ describe('WebSocketController (WsAdapter)', () => { expect(wsCloseSpy).toHaveBeenCalledWith( WsCloseCodeEnum.WS_CLIENT_BAD_REQUEST_CODE, - WsCloseMessageEnum.WS_CLIENT_BAD_REQUEST_MESSAGE + Buffer.from(WsCloseMessageEnum.WS_CLIENT_BAD_REQUEST_MESSAGE) ); wsCloseSpy.mockRestore(); @@ -231,7 +231,7 @@ describe('WebSocketController (WsAdapter)', () => { expect(wsCloseSpy).toHaveBeenCalledWith( WsCloseCodeEnum.WS_CLIENT_NOT_FOUND_CODE, - WsCloseMessageEnum.WS_CLIENT_NOT_FOUND_MESSAGE + Buffer.from(WsCloseMessageEnum.WS_CLIENT_NOT_FOUND_MESSAGE) ); authorizeConnectionSpy.mockRestore(); @@ -253,7 +253,7 @@ describe('WebSocketController (WsAdapter)', () => { expect(wsCloseSpy).toHaveBeenCalledWith( WsCloseCodeEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_CODE, - WsCloseMessageEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_MESSAGE + Buffer.from(WsCloseMessageEnum.WS_CLIENT_UNAUTHORISED_CONNECTION_MESSAGE) ); wsCloseSpy.mockRestore(); @@ -298,7 +298,7 @@ describe('WebSocketController (WsAdapter)', () => { expect(setupConnectionSpy).toHaveBeenCalledWith(expect.anything(), 'TEST'); expect(wsCloseSpy).toHaveBeenCalledWith( WsCloseCodeEnum.WS_CLIENT_ESTABLISHING_CONNECTION_CODE, - WsCloseMessageEnum.WS_CLIENT_ESTABLISHING_CONNECTION_MESSAGE + Buffer.from(WsCloseMessageEnum.WS_CLIENT_ESTABLISHING_CONNECTION_MESSAGE) ); wsCloseSpy.mockRestore(); diff --git a/apps/server/src/modules/tldraw/repo/tldraw-board.repo.spec.ts b/apps/server/src/modules/tldraw/repo/tldraw-board.repo.spec.ts index a7003b7f395..57c9e9f8e29 100644 --- a/apps/server/src/modules/tldraw/repo/tldraw-board.repo.spec.ts +++ b/apps/server/src/modules/tldraw/repo/tldraw-board.repo.spec.ts @@ -4,6 +4,7 @@ import WebSocket from 'ws'; import { WsAdapter } from '@nestjs/platform-ws'; import { Doc } from 'yjs'; import { createMock, DeepMocked } from '@golevelup/ts-jest'; +import { HttpService } from '@nestjs/axios'; import { Logger } from '@src/core/logger'; import { ConfigModule } from '@nestjs/config'; import { MongoMemoryDatabaseModule } from '@infra/database'; @@ -18,7 +19,6 @@ import { TldrawWs } from '../controller'; import { MetricsService } from '../metrics'; import { TldrawRepo } from './tldraw.repo'; import { YMongodb } from './y-mongodb'; -import { HttpService } from '@nestjs/axios'; describe('TldrawBoardRepo', () => { let app: INestApplication; diff --git a/apps/server/src/modules/tldraw/repo/y-mongodb.spec.ts b/apps/server/src/modules/tldraw/repo/y-mongodb.spec.ts index 49ba7bcae84..5b614fda7bb 100644 --- a/apps/server/src/modules/tldraw/repo/y-mongodb.spec.ts +++ b/apps/server/src/modules/tldraw/repo/y-mongodb.spec.ts @@ -7,6 +7,7 @@ import { Logger } from '@src/core/logger'; import { createMock } from '@golevelup/ts-jest'; import * as Yjs from 'yjs'; import { createConfigModuleOptions } from '@src/config'; +import { HttpService } from '@nestjs/axios'; import { tldrawEntityFactory, tldrawTestConfig } from '../testing'; import { TldrawDrawing } from '../entities'; import { TldrawWs } from '../controller'; @@ -15,7 +16,6 @@ import { MetricsService } from '../metrics'; import { TldrawBoardRepo } from './tldraw-board.repo'; import { TldrawRepo } from './tldraw.repo'; import { YMongodb } from './y-mongodb'; -import { HttpService } from '@nestjs/axios'; jest.mock('yjs', () => { const moduleMock: unknown = {