Skip to content

Commit

Permalink
#RI-3063-fix IT
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAllayarovSofteq committed Jun 23, 2022
1 parent c1e384d commit abba002
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion redisinsight/api/src/modules/browser/dto/stream.dto.ts
Expand Up @@ -33,7 +33,7 @@ export class StreamEntryDto {
@ApiProperty({
type: Object,
description: 'Entry fields',
example: { field1: 'value1', field2: 'value2' },
example: [['field1', 'value1'], ['field2', 'value2']],
})
@IsDefined()
@IsNotEmpty()
Expand Down
Expand Up @@ -16,21 +16,20 @@ const { server, request, constants, rte } = deps;
const endpoint = (instanceId = constants.TEST_INSTANCE_ID) =>
request(server).post(`/instance/${instanceId}/streams/entries`);

const entrySchema = Joi.object().keys({
id: Joi.string().label('entries.0.id').required(),
fields: Joi.object().label('entries.0.fields').required()
.messages({
'object.base': '{#label} must be an array',
const entrySchema = Joi.object().keys({
id: Joi.string().label('entries.0.id').required(),
fields: Joi.array().label('entries.0.fields').items(Joi.any()).required().messages({
'array.base': '{#label} must be an array',
}),
});

const dataSchema = Joi.object({
keyName: Joi.string().allow('').required(),
entries: Joi.array().items(entrySchema).required().messages({
'array.sparse': 'entries must be either object or array',
'array.base': 'property {#label} must be either object or array',
}),
}).strict();
});
const dataSchema = Joi.object({
keyName: Joi.string().allow('').required(),
entries: Joi.array().items(entrySchema).required().messages({
'array.sparse': 'entries must be either object or array',
'array.base': '{#label} must be either object or array',
}),
}).strict();

const responseSchema = Joi.object().keys({
keyName: Joi.string().required(),
Expand Down Expand Up @@ -191,8 +190,8 @@ describe('POST /instance/:instanceId/streams/entries', () => {
{
id: '*',
fields: [
[constants.TEST_STREAM_FIELD_1, constants.TEST_STREAM_FIELD_1],
[constants.TEST_STREAM_FIELD_2, constants.TEST_STREAM_FIELD_2]
[constants.TEST_STREAM_VALUE_1, constants.TEST_STREAM_VALUE_1],
[constants.TEST_STREAM_VALUE_2, constants.TEST_STREAM_VALUE_2]
],
},
]
Expand Down
Expand Up @@ -17,18 +17,17 @@ const endpoint = (instanceId = constants.TEST_INSTANCE_ID) =>
request(server).post(`/instance/${instanceId}/streams`);

const entrySchema = Joi.object().keys({
id: Joi.string().label('entries.0.id').required(),
fields: Joi.array().label('entries.0.fields').required()
.messages({
'object.base': '{#label} must be an array',
}),
id: Joi.string().label('entries.0.id').required(),
fields: Joi.array().label('entries.0.fields').items(Joi.any()).required().messages({
'array.base': '{#label} must be an array',
}),
});

const dataSchema = Joi.object({
keyName: Joi.string().allow('').required(),
entries: Joi.array().items(entrySchema).required().messages({
'array.sparse': 'entries must be either object or array',
'array.base': 'property {#label} must be an array',
'array.base': '{#label} must be either object or array',
}),
expire: Joi.number().integer().allow(null).min(1).max(2147483647),
}).strict();
Expand Down

0 comments on commit abba002

Please sign in to comment.