@@ -13,7 +13,6 @@ import {
13
13
import { SettingsService } from 'src/modules/settings/settings.service' ;
14
14
import { AutodiscoveryService } from 'src/modules/autodiscovery/autodiscovery.service' ;
15
15
import { DatabaseService } from 'src/modules/database/database.service' ;
16
- import { mocked } from 'ts-jest/utils' ;
17
16
import config , { Config } from 'src/utils/config' ;
18
17
import { RedisClientFactory } from 'src/modules/redis/redis.client.factory' ;
19
18
import { ConstantsProvider } from 'src/modules/constants/providers/constants.provider' ;
@@ -84,7 +83,7 @@ describe('AutodiscoveryService', () => {
84
83
databaseService = module . get ( DatabaseService ) ;
85
84
redisClientFactory = module . get ( RedisClientFactory ) ;
86
85
87
- mocked ( utils . convertRedisInfoReplyToObject ) . mockReturnValue ( {
86
+ ( utils . convertRedisInfoReplyToObject as jest . Mock ) . mockReturnValue ( {
88
87
server : {
89
88
redis_mode : 'standalone' ,
90
89
} ,
@@ -155,7 +154,7 @@ describe('AutodiscoveryService', () => {
155
154
let addRedisDatabaseSpy ;
156
155
157
156
beforeEach ( async ( ) => {
158
- mocked ( getAvailableEndpoints ) . mockResolvedValue ( [ ] ) ;
157
+ ( getAvailableEndpoints as jest . Mock ) . mockResolvedValue ( [ ] ) ;
159
158
addRedisDatabaseSpy = jest . spyOn ( service as any , 'addRedisDatabase' ) ;
160
159
addRedisDatabaseSpy . mockResolvedValue ( null ) ;
161
160
} ) ;
@@ -167,7 +166,8 @@ describe('AutodiscoveryService', () => {
167
166
} ) ;
168
167
169
168
it ( 'should should call addRedisDatabase 2 times' , async ( ) => {
170
- mocked ( getAvailableEndpoints ) . mockResolvedValueOnce ( [ mockAutodiscoveryEndpoint , mockAutodiscoveryEndpoint ] ) ;
169
+ ( getAvailableEndpoints as jest . Mock )
170
+ . mockResolvedValueOnce ( [ mockAutodiscoveryEndpoint , mockAutodiscoveryEndpoint ] ) ;
171
171
await service [ 'discoverDatabases' ] ( mockSessionMetadata ) ;
172
172
173
173
expect ( addRedisDatabaseSpy ) . toHaveBeenCalledTimes ( 2 ) ;
@@ -193,7 +193,7 @@ describe('AutodiscoveryService', () => {
193
193
} ) ;
194
194
195
195
it ( 'should not create database if redis_mode is not standalone' , async ( ) => {
196
- mocked ( utils . convertRedisInfoReplyToObject ) . mockReturnValueOnce ( {
196
+ ( utils . convertRedisInfoReplyToObject as jest . Mock ) . mockReturnValueOnce ( {
197
197
server : {
198
198
redis_mode : 'cluster' ,
199
199
} ,
0 commit comments