-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle empty object in security array (#1678)
- Loading branch information
1 parent
f7211ce
commit 9e1ea70
Showing
2 changed files
with
46 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}); | ||
}); | ||
}); | ||
}); |