Skip to content

Commit 2a3411a

Browse files
#RI-3527 - fix IT test
1 parent bb7b73e commit 2a3411a

File tree

3 files changed

+50
-22
lines changed

3 files changed

+50
-22
lines changed

redisinsight/api/src/modules/database-analysis/models/database-analysis.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export class DatabaseAnalysis {
125125
@Expose()
126126
@Type(() => Recommendation)
127127
recommendations: Recommendation[];
128+
128129
@ApiPropertyOptional({
129130
description: 'Logical database number.',
130131
type: Number,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
spec:
2-
- 'test/api/database-analysis/**/*.test.ts'
2+
- 'test/**/*.test.ts'
33
require: 'test/api/api.deps.init.ts'
44
timeout: 60000
55
exit: true

redisinsight/api/test/api/database-analysis/POST-databases-id-analysis.test.ts

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ describe('POST /databases/:instanceId/analysis', () => {
258258
].map(mainCheckFn);
259259
});
260260

261-
describe('rediSearch recommendation with ReJSON', () => {
261+
describe('recommendations with ReJSON', () => {
262262
requirements('rte.modules.rejson');
263263
[
264264
{
@@ -281,6 +281,53 @@ describe('POST /databases/:instanceId/analysis', () => {
281281
expect(await repository.count()).to.eq(5);
282282
}
283283
},
284+
{
285+
name: 'Should create new database analysis with searchIndexes recommendation',
286+
data: {
287+
delimiter: '-',
288+
},
289+
statusCode: 201,
290+
responseSchema,
291+
before: async () => {
292+
const jsonValue = JSON.stringify(constants.TEST_REJSON_VALUE_1);
293+
await rte.data.sendCommand('ZADD', [constants.TEST_ZSET_KEY_1, constants.TEST_ZSET_MEMBER_1_SCORE, constants.TEST_ZSET_MEMBER_1]);
294+
await rte.data.sendCommand('json.set', [constants.TEST_ZSET_MEMBER_1, '.', jsonValue]);
295+
},
296+
checkFn: async ({ body }) => {
297+
expect(body.recommendations).to.include.deep.members([
298+
constants.TEST_SEARCH_INDEXES_RECOMMENDATION,
299+
]);
300+
},
301+
after: async () => {
302+
expect(await repository.count()).to.eq(5);
303+
}
304+
},
305+
].map(mainCheckFn);
306+
});
307+
308+
describe('searchIndexes recommendation', () => {
309+
requirements('!rte.pass');
310+
[
311+
{
312+
name: 'Should create new database analysis with searchIndexes recommendation',
313+
data: {
314+
delimiter: '-',
315+
},
316+
statusCode: 201,
317+
responseSchema,
318+
before: async () => {
319+
await rte.data.sendCommand('ZADD', [constants.TEST_ZSET_KEY_1, constants.TEST_ZSET_MEMBER_1_SCORE, constants.TEST_ZSET_MEMBER_1]);
320+
await rte.data.sendCommand('HSET', [constants.TEST_ZSET_MEMBER_1, constants.TEST_HASH_FIELD_1_NAME, constants.TEST_HASH_FIELD_1_VALUE]);
321+
},
322+
checkFn: async ({ body }) => {
323+
expect(body.recommendations).to.include.deep.members([
324+
constants.TEST_SEARCH_INDEXES_RECOMMENDATION,
325+
]);
326+
},
327+
after: async () => {
328+
expect(await repository.count()).to.eq(5);
329+
}
330+
},
284331
].map(mainCheckFn);
285332
});
286333

@@ -471,26 +518,6 @@ describe('POST /databases/:instanceId/analysis', () => {
471518
expect(await repository.count()).to.eq(5);
472519
}
473520
},
474-
{
475-
name: 'Should create new database analysis with searchIndexes recommendation',
476-
data: {
477-
delimiter: '-',
478-
},
479-
statusCode: 201,
480-
responseSchema,
481-
before: async () => {
482-
await rte.data.sendCommand('ZADD', [constants.TEST_ZSET_KEY_1, constants.TEST_ZSET_MEMBER_1_SCORE, constants.TEST_ZSET_MEMBER_1]);
483-
await rte.data.sendCommand('HSET', [constants.TEST_ZSET_MEMBER_1, constants.TEST_HASH_FIELD_1_NAME, constants.TEST_HASH_FIELD_1_VALUE]);
484-
},
485-
checkFn: async ({ body }) => {
486-
expect(body.recommendations).to.include.deep.members([
487-
constants.TEST_SEARCH_INDEXES_RECOMMENDATION,
488-
]);
489-
},
490-
after: async () => {
491-
expect(await repository.count()).to.eq(5);
492-
}
493-
},
494521
{
495522
name: 'Should create new database analysis with luaScript recommendation',
496523
data: {

0 commit comments

Comments
 (0)