Skip to content

Commit

Permalink
Change naming tldraw controller
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejpass committed Sep 25, 2023
1 parent a4784bf commit 97f5b6c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { ConfigModule } from '@nestjs/config';
import { createConfigModuleOptions } from '@src/config';
import { config } from '@src/modules/tldraw/config';
import * as Utils from '../../utils/utils';
import { TldrawController } from '../tldraw.controller';
import { TldrawWsController } from '../tldraw-ws.controller';

describe('WebSocketController (WsAdapter)', () => {
let app: INestApplication;
let gateway: TldrawController;
let gateway: TldrawWsController;
let ws: WebSocket;

const gatewayPort = 3346;
Expand Down Expand Up @@ -44,9 +44,9 @@ describe('WebSocketController (WsAdapter)', () => {
const imports = [CoreModule, ConfigModule.forRoot(createConfigModuleOptions(config))];
const testingModule = await Test.createTestingModule({
imports,
providers: [TldrawController],
providers: [TldrawWsController],
}).compile();
gateway = testingModule.get<TldrawController>(TldrawController);
gateway = testingModule.get<TldrawWsController>(TldrawWsController);
app = testingModule.createNestApplication();
app.useWebSocketAdapter(new WsAdapter(app));
await app.init();
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/modules/tldraw/controller/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './tldraw.controller';
export * from './tldraw-ws.controller';
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import { TextEncoder } from 'util';
import * as SyncProtocols from 'y-protocols/sync';
import * as AwarenessProtocol from 'y-protocols/awareness';
import { encoding } from 'lib0';
import { TldrawController } from '.';
import { TldrawWsController } from '.';

describe('TldrawGateway', () => {
describe('TldrawWSConytoller', () => {
let app: INestApplication;
let gateway: TldrawController;
let gateway: TldrawWsController;
let ws: WebSocket;

const gatewayPort = 3346;
Expand All @@ -39,10 +39,10 @@ describe('TldrawGateway', () => {
const imports = [CoreModule, ConfigModule.forRoot(createConfigModuleOptions(config))];
const testingModule = await Test.createTestingModule({
imports,
providers: [TldrawController],
providers: [TldrawWsController],
}).compile();

gateway = testingModule.get<TldrawController>(TldrawController);
gateway = testingModule.get<TldrawWsController>(TldrawWsController);
app = testingModule.createNestApplication();
app.useWebSocketAdapter(new WsAdapter(app));
jest.useFakeTimers({ advanceTimers: true, doNotFake: ['setInterval', 'clearInterval', 'setTimeout'] });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { WsCloseCodeEnum } from '@src/modules/tldraw/types/ws-close-code-enum';
import { setupWSConnection, setPersistence, updateDocument } from '../utils';

@WebSocketGateway(SOCKET_PORT)
export class TldrawController implements OnGatewayInit, OnGatewayConnection {
export class TldrawWsController implements OnGatewayInit, OnGatewayConnection {
@WebSocketServer()
server!: Server;

Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/tldraw/tldraw.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { ConfigModule } from '@nestjs/config';
import { createConfigModuleOptions } from '@src/config';
import { CoreModule } from '@src/core';
import { Logger } from '@src/core/logger';
import { TldrawController } from './controller';
import { TldrawWsController } from './controller';
import { config } from './config';

const imports = [CoreModule, ConfigModule.forRoot(createConfigModuleOptions(config))];

@Module({
imports,
providers: [Logger, TldrawController],
providers: [Logger, TldrawWsController],
})
export class TldrawModule {}

0 comments on commit 97f5b6c

Please sign in to comment.