Skip to content

Commit

Permalink
fix other test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
davwas committed Jan 15, 2024
1 parent a7f2c36 commit 9f86f19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/modules/tldraw/repo/y-mongodb.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 = {
Expand Down

0 comments on commit 9f86f19

Please sign in to comment.