Skip to content

Commit f4358f5

Browse files
fix ITests
1 parent e518bab commit f4358f5

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

redisinsight/api/test/api/hash/DELETE-databases-id-hash-fields.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '../deps';
1111
const { server, request, constants, rte } = deps;
1212
import * as Joi from 'joi';
13+
import { convertArrayReplyToObject } from 'src/modules/redis/utils';
1314

1415
// endpoint to test
1516
const endpoint = (instanceId = constants.TEST_INSTANCE_ID) =>
@@ -89,7 +90,7 @@ describe('DELETE /databases/:instanceId/hash/fields', () => {
8990
affected: 0,
9091
},
9192
after: async () => {
92-
const fields = await rte.client.hgetall(constants.TEST_HASH_KEY_2);
93+
const fields = convertArrayReplyToObject(await rte.client.hgetall(constants.TEST_HASH_KEY_2));
9394
(new Array(3000).fill(0)).map((_, i) => {
9495
expect(fields[`field_${i + 1}`]).to.eql(`value_${i + 1}`);
9596
});
@@ -106,7 +107,7 @@ describe('DELETE /databases/:instanceId/hash/fields', () => {
106107
affected: 1,
107108
},
108109
after: async () => {
109-
const fields = await rte.client.hgetall(constants.TEST_HASH_KEY_2);
110+
const fields = convertArrayReplyToObject(await rte.client.hgetall(constants.TEST_HASH_KEY_2));
110111
(new Array(2999).fill(0)).map((_, i) => {
111112
expect(fields[`field_${i + 1}`]).to.eql(`value_${i + 1}`);
112113
});
@@ -123,7 +124,7 @@ describe('DELETE /databases/:instanceId/hash/fields', () => {
123124
affected: 4,
124125
},
125126
after: async () => {
126-
const fields = await rte.client.hgetall(constants.TEST_HASH_KEY_2);
127+
const fields = convertArrayReplyToObject(await rte.client.hgetall(constants.TEST_HASH_KEY_2));
127128
(new Array(2995).fill(0)).map((_, i) => {
128129
expect(fields[`field_${i + 3}`]).to.eql(`value_${i + 3}`);
129130
});

redisinsight/api/test/api/hash/POST-databases-id-hash.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from '../deps';
1212
const { server, request, constants, rte } = deps;
1313
import * as Joi from 'joi';
14+
import { convertArrayReplyToObject } from 'src/modules/redis/utils';
1415

1516
// endpoint to test
1617
const endpoint = (instanceId = constants.TEST_INSTANCE_ID) =>
@@ -62,7 +63,7 @@ const createCheckFn = async (testCase) => {
6263
} else {
6364
if (testCase.statusCode === 201) {
6465
expect(await rte.client.exists(testCase.data.keyName)).to.eql(1);
65-
expect(await rte.client.hgetall(testCase.data.keyName)).to.eql({
66+
expect(convertArrayReplyToObject(await rte.client.hgetall(testCase.data.keyName))).to.eql({
6667
[testCase.data.fields[0].field]: testCase.data.fields[0].value,
6768
});
6869
if (testCase.data.expire) {
@@ -188,7 +189,7 @@ describe('POST /databases/:instanceId/hash', () => {
188189
},
189190
after: async () =>
190191
// check that value was not overwritten
191-
expect(await rte.client.hgetall(constants.TEST_HASH_KEY_1)).to.deep.eql({
192+
expect(convertArrayReplyToObject(await rte.client.hgetall(constants.TEST_HASH_KEY_1))).to.deep.eql({
192193
[constants.TEST_HASH_FIELD_1_NAME]: constants.TEST_HASH_FIELD_1_VALUE,
193194
})
194195
},

redisinsight/api/test/api/hash/PUT-databases-id-hash.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '../deps';
1111
const { server, request, constants, rte } = deps;
1212
import * as Joi from 'joi';
13+
import { convertArrayReplyToObject } from 'src/modules/redis/utils';
1314

1415
// endpoint to test
1516
const endpoint = (instanceId = constants.TEST_INSTANCE_ID) =>
@@ -111,7 +112,7 @@ describe('PUT /databases/:instanceId/hash', () => {
111112
},
112113
statusCode: 200,
113114
after: async () => {
114-
expect(await rte.client.hgetall(constants.TEST_HASH_KEY_1)).to.eql({
115+
expect(convertArrayReplyToObject(await rte.client.hgetall(constants.TEST_HASH_KEY_1))).to.eql({
115116
[constants.TEST_HASH_FIELD_1_NAME]: '',
116117
[constants.TEST_HASH_FIELD_2_NAME]: constants.TEST_HASH_FIELD_2_VALUE,
117118
['new_field']: 'new_value',

0 commit comments

Comments
 (0)