mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
refactor: methods order, types in e2e test
This commit is contained in:
@@ -17,7 +17,7 @@ async function createNestApp(...gateways): Promise<INestApplication> {
|
||||
}
|
||||
|
||||
describe('WebSocketGateway', () => {
|
||||
let ws, app;
|
||||
let ws: ReturnType<typeof io>, app: INestApplication;
|
||||
|
||||
it(`should handle message (2nd port)`, async () => {
|
||||
app = await createNestApp(ApplicationGateway);
|
||||
@@ -100,7 +100,7 @@ describe('WebSocketGateway', () => {
|
||||
);
|
||||
});
|
||||
|
||||
describe('Shared Server for WebSocket and Long-Running Connections', () => {
|
||||
describe('shared server for WS and Long-Running connections', () => {
|
||||
afterEach(() => {});
|
||||
it('should block application shutdown', function (done) {
|
||||
let eventSource;
|
||||
@@ -126,7 +126,7 @@ describe('WebSocketGateway', () => {
|
||||
ws = io(`http://localhost:3000`);
|
||||
eventSource = new EventSource(`http://localhost:3000/sse`);
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
ws.on('connect', resolve);
|
||||
ws.on('error', reject);
|
||||
});
|
||||
@@ -155,7 +155,7 @@ describe('WebSocketGateway', () => {
|
||||
ws = io(`http://localhost:3000`);
|
||||
const eventSource = new EventSource(`http://localhost:3000/sse`);
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
ws.on('connect', resolve);
|
||||
ws.on('error', reject);
|
||||
});
|
||||
|
||||
@@ -19,6 +19,10 @@ export abstract class AbstractWsAdapter<
|
||||
protected readonly httpServer: any;
|
||||
private _forceCloseConnections: boolean;
|
||||
|
||||
public set forceCloseConnections(value: boolean) {
|
||||
this._forceCloseConnections = value;
|
||||
}
|
||||
|
||||
constructor(appOrHttpServer?: INestApplicationContext | any) {
|
||||
if (appOrHttpServer && appOrHttpServer instanceof NestApplication) {
|
||||
this.httpServer = appOrHttpServer.getUnderlyingHttpServer();
|
||||
@@ -27,10 +31,6 @@ export abstract class AbstractWsAdapter<
|
||||
}
|
||||
}
|
||||
|
||||
public set forceCloseConnections(value: boolean) {
|
||||
this._forceCloseConnections = value;
|
||||
}
|
||||
|
||||
public bindClientConnect(server: TServer, callback: Function) {
|
||||
server.on(CONNECTION_EVENT, callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user