diff --git a/packages/api-explorer-ui/__tests__/Doc.test.jsx b/packages/api-explorer-ui/__tests__/Doc.test.jsx
index c5894fe9b..097c6c5c7 100644
--- a/packages/api-explorer-ui/__tests__/Doc.test.jsx
+++ b/packages/api-explorer-ui/__tests__/Doc.test.jsx
@@ -87,14 +87,77 @@ describe('onSubmit', () => {
expect(doc.state('loading')).toBe(true);
});
- xtest('should make request on Submit', () => {
- const doc = mount();
+ test.only('should make request on Submit', () => {
+ // const req = {
+ // log: {
+ // entries: [
+ // {
+ // request: {
+ // headers: [
+ // {
+ // name: 'Authorization',
+ // value: 'Bearer api-key',
+ // },
+ // ],
+ // queryString: [],
+ // postData: {
+ // text: '{"category":{},"name":1,"photoUrls":[1]}',
+ // },
+ // method: 'POST',
+ // url: 'http://petstore.swagger.io/v2/pet',
+ // },
+ // },
+ // ],
+ // },
+ // };
+
+ const props2 = {
+ doc: {
+ title: 'Title',
+ slug: 'slug',
+ type: 'endpoint',
+ swagger: { path: '/pet' },
+ api: { method: 'post' },
+ formData: {
+ body: {
+ category: { id: undefined, name: undefined },
+ name: '1',
+ photoUrls: ['1'],
+ status: undefined,
+ tags: undefined,
+ },
+ },
+ // requestBody: { type: 'object', properties: { a: { type: 'string' } } },
+ onSubmit: () => {},
+ },
+ oas,
+ setLanguage: () => {},
+ };
+ const doc = mount();
doc.instance().onSubmit();
doc.instance().onChange({ auth: { api_key: 'api-key' } });
doc.instance().onSubmit();
- expect(doc.state('result')).toBe(false);
- expect(doc.state('needsAuth')).toBe(false);
+ expect(doc.state('result')).toEqual({
+ init: true,
+ isBinary: false,
+ method: 'POST',
+ requestHeaders: 'Authorization : Bearer api-key',
+ responseHeaders: 'content-disposition,application/json',
+ statusCode: [200, 'OK', 'success'],
+ responseBody: {
+ id: 9205436248879918000,
+ category: { id: 0 },
+ name: '1',
+ photoUrls: ['1'],
+ tags: [],
+ },
+ url: 'http://petstore.swagger.io/v2/pet',
+ });
+ expect(doc.state('loading')).toBe(false);
+ expect(doc.state('responseTabClass')).toBe(
+ 'hub-reference-right hub-reference-results tabber-parent on',
+ );
});
});
diff --git a/packages/api-explorer-ui/src/CodeSampleResponseTabs.jsx b/packages/api-explorer-ui/src/CodeSampleResponseTabs.jsx
index 360066f33..fe3610894 100644
--- a/packages/api-explorer-ui/src/CodeSampleResponseTabs.jsx
+++ b/packages/api-explorer-ui/src/CodeSampleResponseTabs.jsx
@@ -26,7 +26,7 @@ class CodeSampleResponseTabs extends React.Component {
render() {
const { styleClass, result, oas, operation, hideResults } = this.props;
- const allSecurities = operation.prepareSecurity();
+ // const allSecurities = operation.prepareSecurity();
return (
@@ -82,7 +82,7 @@ class CodeSampleResponseTabs extends React.Component {
>
Metadata
- {/* {showCodeResults(oas, operation).length && (
+ {showCodeResults(oas, operation).length > 0 && (
to examples
- )} */}
+ )}