Skip to content

Commit 24a8866

Browse files
update jest
1 parent 66e26aa commit 24a8866

30 files changed

+1096
-1686
lines changed

redisinsight/api/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"resolutions": {
4343
"nanoid": "^3.1.31",
4444
"word-wrap": "1.2.4",
45+
"jest/**/micromatch": "^4.0.8",
46+
"ts-loader/micromatch": "^4.0.8",
4547
"mocha/minimatch": "^3.0.5",
4648
"@nestjs/platform-socket.io/socket.io": "^4.8.0",
4749
"**/semver": "^7.5.2",
@@ -120,7 +122,7 @@
120122
"eslint-plugin-import": "^2.20.1",
121123
"eslint-plugin-sonarjs": "^0.9.1",
122124
"ioredis-mock": "^8.2.2",
123-
"jest": "^26.6.3",
125+
"jest": "^29.7.0",
124126
"jest-when": "^3.2.1",
125127
"joi": "^17.4.0",
126128
"mocha": "^8.4.0",
@@ -132,7 +134,7 @@
132134
"rimraf": "^3.0.2",
133135
"socket.io-mock": "^1.3.2",
134136
"supertest": "^4.0.2",
135-
"ts-jest": "^26.1.0",
137+
"ts-jest": "^29.2.5",
136138
"ts-loader": "^6.2.1",
137139
"ts-mocha": "^8.0.0",
138140
"ts-node": "^9.1.1",
@@ -164,8 +166,7 @@
164166
"moduleNameMapper": {
165167
"src/(.*)": "<rootDir>/$1",
166168
"apiSrc/(.*)": "<rootDir>/$1",
167-
"tests/(.*)": "<rootDir>/__tests__/$1",
168-
"axios": "axios/dist/node/axios.cjs"
169+
"tests/(.*)": "<rootDir>/__tests__/$1"
169170
}
170171
}
171172
}

redisinsight/api/src/__mocks__/bulk-actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const mockCombinedStream = {
4848

4949
export const mockBulkActionOverviewMatcher = {
5050
...mockBulkActionOverview,
51-
duration: jasmine.any(Number),
51+
duration: expect.any(Number),
5252
};
5353

5454
export const mockBulkActionFilter = new BulkActionFilter();

redisinsight/api/src/modules/ai/query/repositories/local.ai-query.message.repository.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ describe('LocalAiQueryAuthProvider', () => {
5151

5252
encryptionService.decrypt.mockImplementation((value) => value);
5353
when(encryptionService.decrypt)
54-
.calledWith(mockAiQueryHumanMessageEntity.content, jasmine.anything())
54+
.calledWith(mockAiQueryHumanMessageEntity.content, expect.anything())
5555
.mockResolvedValue(mockAiQueryHumanMessage.content)
56-
.calledWith(mockAiQueryAiResponseEntity.content, jasmine.anything())
56+
.calledWith(mockAiQueryAiResponseEntity.content, expect.anything())
5757
.mockResolvedValue(mockAiQueryAiResponse.content)
58-
.calledWith(mockAiQueryAiResponseEntity.steps, jasmine.anything())
58+
.calledWith(mockAiQueryAiResponseEntity.steps, expect.anything())
5959
.mockResolvedValue(JSON.stringify(mockAiQueryAiResponse.steps));
6060

6161
encryptionService.encrypt.mockImplementation((value) => value);
6262
when(encryptionService.encrypt)
63-
.calledWith(mockAiQueryHumanMessage.content, jasmine.anything())
63+
.calledWith(mockAiQueryHumanMessage.content, expect.anything())
6464
.mockResolvedValue(mockAiQueryHumanMessageEntity.content)
65-
.calledWith(mockAiQueryAiResponse.content, jasmine.anything())
65+
.calledWith(mockAiQueryAiResponse.content, expect.anything())
6666
.mockResolvedValue(mockAiQueryAiResponseEntity.content)
67-
.calledWith(JSON.stringify(mockAiQueryAiResponse.steps), jasmine.anything())
67+
.calledWith(JSON.stringify(mockAiQueryAiResponse.steps), expect.anything())
6868
.mockResolvedValue(mockAiQueryAiResponseEntity.steps);
6969
});
7070

redisinsight/api/src/modules/browser/keys/scanner/strategies/cluster.scanner.strategy.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,16 +776,16 @@ describe('Cluster Scanner Strategy', () => {
776776
beforeEach(() => {
777777
when(mockClusterRedisClient.sendPipeline)
778778
.calledWith([
779-
jasmine.arrayContaining([BrowserToolKeysCommands.Ttl]),
780-
jasmine.arrayContaining(['memory', 'usage']),
781-
jasmine.arrayContaining([BrowserToolKeysCommands.Type]),
779+
expect.arrayContaining([BrowserToolKeysCommands.Ttl]),
780+
expect.arrayContaining(['memory', 'usage']),
781+
expect.arrayContaining([BrowserToolKeysCommands.Type]),
782782
],
783783
{ replyEncoding: 'utf8' })
784784
.mockResolvedValue([[null, -1], [null, 50], [null, 'string']]);
785785
when(mockClusterRedisClient.sendPipeline)
786786
.calledWith([
787-
jasmine.arrayContaining([BrowserToolKeysCommands.Ttl]),
788-
jasmine.arrayContaining(['memory', 'usage']),
787+
expect.arrayContaining([BrowserToolKeysCommands.Ttl]),
788+
expect.arrayContaining(['memory', 'usage']),
789789
],
790790
{ replyEncoding: 'utf8' })
791791
.mockResolvedValue([[null, 999], [null, 555]]);

redisinsight/api/src/modules/bulk-actions/bulk-import.service.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ describe('BulkImportService', () => {
162162
spy.mockResolvedValue(mockSummary);
163163
expect(await service.import(mockClientMetadata, mockReadableStream)).toEqual({
164164
...mockImportResult,
165-
duration: jasmine.anything(),
165+
duration: expect.anything(),
166166
});
167167
expect(analytics.sendActionSucceed).toHaveBeenCalledWith({
168168
...mockImportResult,
169-
duration: jasmine.anything(),
169+
duration: expect.anything(),
170170
});
171171
});
172172

@@ -185,7 +185,7 @@ describe('BulkImportService', () => {
185185
failed: 0,
186186
errors: [],
187187
},
188-
duration: jasmine.anything(),
188+
duration: expect.anything(),
189189
});
190190
});
191191

@@ -204,7 +204,7 @@ describe('BulkImportService', () => {
204204
failed: 0,
205205
errors: [],
206206
},
207-
duration: jasmine.anything(),
207+
duration: expect.anything(),
208208
});
209209
});
210210

@@ -225,7 +225,7 @@ describe('BulkImportService', () => {
225225
failed: 2,
226226
errors: [],
227227
},
228-
duration: jasmine.anything(),
228+
duration: expect.anything(),
229229
});
230230
expect(mockStandaloneRedisClient.disconnect).toHaveBeenCalled();
231231
});

redisinsight/api/src/modules/certificate/repositories/local.ca-certificate.repository.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('LocalCaCertificateRepository', () => {
5757
repository.save.mockResolvedValue(mockCaCertificateEntity);
5858
repository.create.mockReturnValue(mockCaCertificate); // not entity since it happens before encryption
5959

60-
when(encryptionService.decrypt).calledWith(mockCaCertificateCertificateEncrypted, jasmine.anything())
60+
when(encryptionService.decrypt).calledWith(mockCaCertificateCertificateEncrypted, expect.anything())
6161
.mockResolvedValue(mockCaCertificateCertificatePlain);
6262
when(encryptionService.encrypt).calledWith(mockCaCertificateCertificatePlain)
6363
.mockResolvedValue({

redisinsight/api/src/modules/certificate/repositories/local.client-certificate.repository.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ describe('LocalClientCertificateRepository', () => {
6565
repository.create.mockReturnValue(mockClientCertificate); // not an entity since create happens before encryption
6666

6767
when(encryptionService.decrypt)
68-
.calledWith(mockClientCertificateCertificateEncrypted, jasmine.anything())
68+
.calledWith(mockClientCertificateCertificateEncrypted, expect.anything())
6969
.mockResolvedValue(mockClientCertificateCertificatePlain)
70-
.calledWith(mockClientCertificateKeyEncrypted, jasmine.anything())
70+
.calledWith(mockClientCertificateKeyEncrypted, expect.anything())
7171
.mockResolvedValue(mockClientCertificateKeyPlain);
7272
when(encryptionService.encrypt)
7373
.calledWith(mockClientCertificateCertificatePlain)

redisinsight/api/src/modules/cloud/capi-key/repository/local.cloud-capi-key.repository.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ describe('LocalCloudCapiKeyRepository', () => {
6060
repository.merge.mockReturnValue(mockFeatureEntity);
6161

6262
when(encryptionService.decrypt)
63-
.calledWith(mockCapiKeyEncrypted, jasmine.anything())
63+
.calledWith(mockCapiKeyEncrypted, expect.anything())
6464
.mockResolvedValue(mockCloudCapiAuthDto.capiKey)
65-
.calledWith(mockCapiSecretEncrypted, jasmine.anything())
65+
.calledWith(mockCapiSecretEncrypted, expect.anything())
6666
.mockResolvedValue(mockCloudCapiAuthDto.capiSecret);
6767

6868
when(encryptionService.encrypt)
@@ -80,7 +80,7 @@ describe('LocalCloudCapiKeyRepository', () => {
8080
});
8181
it('should return null fields in case of decryption errors', async () => {
8282
when(encryptionService.decrypt)
83-
.calledWith(mockCapiKeyEncrypted, jasmine.anything())
83+
.calledWith(mockCapiKeyEncrypted, expect.anything())
8484
.mockRejectedValueOnce(new KeytarDecryptionErrorException());
8585

8686
expect(await service.get(mockDatabase.id)).toEqual({

redisinsight/api/src/modules/custom-tutorial/repositories/local.custom-tutorial.repository.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('LocalCustomTutorialRepository', () => {
7171
expect(result).toEqual(mockCustomTutorial);
7272
expect(repository.save).toHaveBeenCalledWith({
7373
...mockCustomTutorialEntity,
74-
createdAt: jasmine.anything(),
74+
createdAt: expect.anything(),
7575
});
7676
});
7777
});

redisinsight/api/src/modules/database-analysis/scanner/key-info/strategies/abstract.info.strategy.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('AbstractInfoStrategy', () => {
1111

1212
beforeEach(async () => {
1313
when(client.sendCommand)
14-
.calledWith(jasmine.arrayContaining(['hlen']))
14+
.calledWith(expect.arrayContaining(['hlen']))
1515
.mockResolvedValue(mockRedisResponse);
1616
});
1717

@@ -21,7 +21,7 @@ describe('AbstractInfoStrategy', () => {
2121
});
2222
it('should return null in case of error', async () => {
2323
when(client.sendCommand)
24-
.calledWith(jasmine.arrayContaining(['hlen']))
24+
.calledWith(expect.arrayContaining(['hlen']))
2525
.mockRejectedValueOnce(new Error('some error'));
2626

2727
expect(await strategy.getLengthSafe(client, mockKey)).toEqual(null);

0 commit comments

Comments
 (0)