mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
add more tests
This commit is contained in:
parent
3417c956d7
commit
26575e4ae0
|
@ -466,6 +466,14 @@ describe('Utils', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('should return correct min value', () => {
|
||||
expect(humanizeNumberRange({ minimum: 5, exclusiveMinimum: 10 })).toEqual('> 5');
|
||||
});
|
||||
|
||||
it('should return correct max value', () => {
|
||||
expect(humanizeNumberRange({ maximum: 10, exclusiveMaximum: 15 })).toEqual('< 15');
|
||||
});
|
||||
|
||||
it('should return undefined', () => {
|
||||
expect(humanizeNumberRange({})).toEqual(undefined);
|
||||
});
|
||||
|
|
|
@ -428,7 +428,7 @@ export function humanizeNumberRange(schema: OpenAPISchema): string | undefined {
|
|||
: schema.minimum;
|
||||
const maximum =
|
||||
typeof schema.exclusiveMaximum === 'number'
|
||||
? Math.min(schema.exclusiveMaximum, schema.maximum ?? Infinity)
|
||||
? Math.max(schema.exclusiveMaximum, schema.maximum ?? Infinity)
|
||||
: schema.maximum;
|
||||
const exclusiveMinimum =
|
||||
typeof schema.exclusiveMinimum === 'number' ? true : schema.exclusiveMinimum;
|
||||
|
|
Loading…
Reference in New Issue
Block a user