mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-07 21:54:53 +03:00
test: SecurityRequirement component with empty obj
This commit is contained in:
parent
85ac2d169c
commit
a93d53c6bc
27
src/components/__tests__/SecurityRequirement.test.tsx
Normal file
27
src/components/__tests__/SecurityRequirement.test.tsx
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import * as React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
|
|
||||||
|
import { OpenAPIParser } from '../../services';
|
||||||
|
import { SecurityRequirementModel } from '../../services/models/SecurityRequirement';
|
||||||
|
import { SecurityRequirement } from '../SecurityRequirement/SecurityRequirement';
|
||||||
|
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||||
|
|
||||||
|
const options = new RedocNormalizedOptions({});
|
||||||
|
describe('Components', () => {
|
||||||
|
describe('SecurityRequirement', () => {
|
||||||
|
describe('SecurityRequirement', () => {
|
||||||
|
it('should render \'None\' when empty object in security open api', () => {
|
||||||
|
const parser = new OpenAPIParser({ openapi: '3.0', info: { title: 'test', version: '0' }, paths: {} },
|
||||||
|
undefined,
|
||||||
|
options,
|
||||||
|
);
|
||||||
|
const securityRequirement = new SecurityRequirementModel({}, parser);
|
||||||
|
const securityElement = shallow(
|
||||||
|
<SecurityRequirement key={1} security={securityRequirement} />
|
||||||
|
).getElement();
|
||||||
|
expect(securityElement.props.children.type.target).toEqual('span');
|
||||||
|
expect(securityElement.props.children.props.children).toEqual('None');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user