@rfprodz/backend-diagnostics 1.0.21 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,19 +35,18 @@ describe('AppDiagnosticsGateway', () => {
35
35
  ],
36
36
  })
37
37
  .compile()
38
- .then(module => {
38
+ .then(async (module) => {
39
39
  testingModule = module;
40
+ app = testingModule.createNestApplication();
41
+ app.useWebSocketAdapter(new WsAdapter(app));
42
+ await app.listen(appPort, '0.0.0.0');
43
+ const appUrl = await app.getUrl();
44
+ server = new Server({ server: app.getHttpServer() });
40
45
  gateway = testingModule.get(AppDiagnosticsGateway);
41
46
  gatewaySpy = {
42
47
  sendEvent: jest.spyOn(gateway, 'sendEvent'),
43
48
  broadcastEvent: jest.spyOn(gateway, 'broadcastEvent'),
44
49
  };
45
- app = testingModule.createNestApplication();
46
- app.useWebSocketAdapter(new WsAdapter(app));
47
- return app.listen(appPort, '0.0.0.0').then(() => app.getUrl());
48
- })
49
- .then(appUrl => {
50
- server = new Server({ server: app.getHttpServer() });
51
50
  gateway['server'] = server;
52
51
  const wsUrl = `${appUrl.replace(/http/, 'ws')}/api/events`;
53
52
  wsClient = new WebSocket(wsUrl);
@@ -65,9 +64,6 @@ describe('AppDiagnosticsGateway', () => {
65
64
  await service.close();
66
65
  });
67
66
  });
68
- it('test', () => {
69
- expect(true).toBeTruthy();
70
- });
71
67
  it('handleConnection should call broadcastEvent', async () => {
72
68
  expect(wsClient).toBeDefined();
73
69
  addWsClient(server, wsClient);
@@ -81,18 +77,9 @@ describe('AppDiagnosticsGateway', () => {
81
77
  await gateway.handleDisconnect();
82
78
  expect(gatewaySpy.broadcastEvent).toHaveBeenCalledWith({ data: [{ name: 'active', value: 0 }], event: 'users' });
83
79
  expect(gatewaySpy.sendEvent).not.toHaveBeenCalled();
84
- removeWsClient(server, wsClient);
85
80
  });
86
81
  it('handleConnection should not send an event with currently connected users count if input value is not provided and here are no connected users', async () => {
87
82
  await gateway.handleConnection();
88
83
  expect(gatewaySpy.sendEvent).not.toHaveBeenCalled();
89
84
  });
90
- it('handleConnection should send an event with currently connected users count if input value is not provided and here are no connected users', async () => {
91
- expect(wsClient).toBeDefined();
92
- addWsClient(server, wsClient);
93
- await gateway.handleConnection();
94
- expect(gatewaySpy.sendEvent).toHaveBeenCalled();
95
- removeWsClient(server, wsClient);
96
- gatewaySpy.sendEvent.mockClear();
97
- });
98
85
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rfprodz/backend-diagnostics",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "NestJS API diagnostics module.",
5
5
  "keywords": [
6
6
  "nestjs-controller",
@@ -19,17 +19,18 @@
19
19
  "license": "MIT",
20
20
  "author": "rfprod <zoidenmacht@zoho.com>",
21
21
  "dependencies": {
22
- "@jest/types": "29.6.1",
23
- "tslib": "2.6.1",
24
- "ws": "8.13.0"
22
+ "@jest/types": "29.6.3",
23
+ "tslib": "2.6.2",
24
+ "ws": "8.14.1"
25
25
  },
26
26
  "peerDependencies": {
27
- "@nestjs/common": "10.1.3",
28
- "@nestjs/platform-ws": "10.1.3",
29
- "@nestjs/websockets": "10.1.3",
27
+ "@nestjs/common": "10.2.5",
28
+ "@nestjs/platform-ws": "10.2.5",
29
+ "@nestjs/websockets": "10.2.5",
30
30
  "dotenv": "16.3.1",
31
31
  "rxjs": "7.8.1"
32
32
  },
33
- "main": "./src/index.js",
34
- "types": "./src/index.d.ts"
33
+ "module": "./src/index.js",
34
+ "type": "module",
35
+ "main": "./src/index.js"
35
36
  }