Skip to content

Commit 30223a5

Browse files
committed
#RI-4813 - fix tests
1 parent 089ef3d commit 30223a5

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,7 @@ describe('POST /databases', () => {
326326
});
327327
describe('Cloud details', function () {
328328
before(async () => {
329-
await (await localDb.getRepository(localDb.repositories.DATABASE)).clear();
330-
await localDb.createTestDbInstance(rte, {}, { id: constants.TEST_INSTANCE_ID })
329+
await localDb.initLocalDb(deps.rte, deps.server)
331330
});
332331
describe('Cloud details without pass and TLS', function () {
333332
requirements('!rte.tls');
@@ -355,9 +354,12 @@ describe('POST /databases', () => {
355354
statusCode: 409,
356355
error: 'DatabaseAlreadyExists',
357356
errorCode: CustomErrorCodes.DatabaseAlreadyExists,
358-
resource: {
359-
databaseId: constants.TEST_INSTANCE_ID,
360-
}
357+
},
358+
checkFn: async ({ body }) => {
359+
const database = await (await localDb.getRepository(localDb.repositories.DATABASE))
360+
.findOneBy({ host: constants.TEST_REDIS_HOST });
361+
362+
expect(body.resource.databaseId).to.eq(database.id);
361363
},
362364
});
363365
});
@@ -400,9 +402,12 @@ describe('POST /databases', () => {
400402
statusCode: 409,
401403
error: 'DatabaseAlreadyExists',
402404
errorCode: CustomErrorCodes.DatabaseAlreadyExists,
403-
resource: {
404-
databaseId: constants.TEST_INSTANCE_ID,
405-
}
405+
},
406+
checkFn: async ({ body }) => {
407+
const database = await (await localDb.getRepository(localDb.repositories.DATABASE))
408+
.findOneBy({ host: constants.TEST_REDIS_HOST });
409+
410+
expect(body.resource.databaseId).to.eq(database.id);
406411
},
407412
});
408413
});

0 commit comments

Comments
 (0)