Skip to content

Commit dc8ef5a

Browse files
fix tests
1 parent 24a8866 commit dc8ef5a

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

redisinsight/api/src/modules/ai/query/ai-query.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('AiQueryService', () => {
5757
clientSocket.disconnect();
5858
serverSocket.disconnect();
5959
wsServer.close();
60-
httpServer.stop();
60+
httpServer?.stop();
6161
});
6262

6363
beforeEach(async () => {

redisinsight/api/src/modules/autodiscovery/utils/autodiscovery.util.spec.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
import * as os from 'os';
55
import * as ch from 'child_process';
66
import * as net from 'net';
7-
import { mocked } from 'ts-jest/utils';
87
import * as events from 'events';
98
import * as stream from 'stream';
109
import { ChildProcess } from 'child_process';
@@ -39,17 +38,17 @@ describe('getSpawnArgs', () => {
3938
const getSpawnArgsTests = [
4039
{
4140
name: 'Linux',
42-
before: () => mocked(os.type).mockReturnValue('Linux'),
41+
before: () => (os.type as jest.Mock).mockReturnValue('Linux'),
4342
output: ['netstat', ['-anpt']],
4443
},
4544
{
4645
name: 'Darwin',
47-
before: () => mocked(os.type).mockReturnValue('Darwin'),
46+
before: () => (os.type as jest.Mock).mockReturnValue('Darwin'),
4847
output: ['netstat', ['-anvp', 'tcp']],
4948
},
5049
{
5150
name: 'Windows_NT',
52-
before: () => mocked(os.type).mockReturnValue('Windows_NT'),
51+
before: () => (os.type as jest.Mock).mockReturnValue('Windows_NT'),
5352
output: ['netstat.exe', ['-a', '-n', '-o']],
5453
},
5554
];
@@ -67,8 +66,8 @@ describe('getSpawnArgs', () => {
6766

6867
describe('getRunningProcesses', () => {
6968
beforeEach(() => {
70-
mocked(os.type).mockReturnValue('Linux');
71-
mocked(ch.spawn).mockReturnValue(mockChildProcess);
69+
(os.type as jest.Mock).mockReturnValue('Linux');
70+
(ch.spawn as jest.Mock).mockReturnValue(mockChildProcess);
7271
});
7372
const getRunningProcessesTests = [
7473
{
@@ -94,7 +93,7 @@ describe('getRunningProcesses', () => {
9493
});
9594

9695
it('Should throw an error for unsupported platform', async () => {
97-
mocked(os.type).mockReturnValueOnce('custom_os');
96+
(os.type as jest.Mock).mockReturnValueOnce('custom_os');
9897

9998
try {
10099
await autodiscoveryUtility.getRunningProcesses();
@@ -172,7 +171,7 @@ describe('getTCPEndpoints', () => {
172171

173172
describe('testEndpoint', () => {
174173
beforeEach(() => {
175-
mocked(net.createConnection).mockReturnValue(mockSocket);
174+
(net.createConnection as jest.Mock).mockReturnValue(mockSocket);
176175
});
177176
const testEndpointTests = [
178177
{
@@ -224,7 +223,7 @@ describe('getAvailableEndpoints', () => {
224223
beforeEach(() => {
225224
const getRunningProcessesSpy = jest.spyOn(autodiscoveryUtility, 'getRunningProcesses');
226225
getRunningProcessesSpy.mockResolvedValue(['']);
227-
mocked(net.createConnection).mockReturnValue(mockSocket);
226+
(net.createConnection as jest.Mock).mockReturnValue(mockSocket);
228227
});
229228
const getAvailableEndpointsTests = [
230229
{

redisinsight/api/yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,20 +2372,20 @@ brace-expansion@^2.0.1:
23722372
dependencies:
23732373
balanced-match "^1.0.0"
23742374

2375-
braces@^3.0.2, braces@~3.0.2:
2376-
version "3.0.2"
2377-
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
2378-
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
2379-
dependencies:
2380-
fill-range "^7.0.1"
2381-
23822375
braces@^3.0.3:
23832376
version "3.0.3"
23842377
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
23852378
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
23862379
dependencies:
23872380
fill-range "^7.1.1"
23882381

2382+
braces@~3.0.2:
2383+
version "3.0.2"
2384+
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
2385+
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
2386+
dependencies:
2387+
fill-range "^7.0.1"
2388+
23892389
broadcast-channel@~4.17.0:
23902390
version "4.17.0"
23912391
resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.17.0.tgz#599d44674b09a4e2e07af6da5d03b45ca8bffd11"

0 commit comments

Comments
 (0)