Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
correct all build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
uppal101 committed Nov 2, 2017
1 parent b9640c7 commit a572f07
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 33 deletions.
24 changes: 15 additions & 9 deletions packages/api-explorer-ui/__tests__/lib/Oas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,22 @@ test('should be able to access properties on oas', () => {
});

describe('operation.getSecurity()', () => {
const security = [{ 'auth': [] }];
const security = [{ auth: [] }];

test('should return the security on this endpoint', () => {
expect(
new Oas({
info: { version: '1.0' },
paths: {
'/things': {
'post': {
post: {
security,
}
},
},
}
}).operation('/things', 'post').getSecurity(),
},
})
.operation('/things', 'post')
.getSecurity(),
).toBe(security);
});

Expand All @@ -94,11 +96,13 @@ describe('operation.getSecurity()', () => {
info: { version: '1.0' },
paths: {
'/things': {
'post': {}
post: {},
},
},
security,
}).operation('/things', 'post').getSecurity(),
})
.operation('/things', 'post')
.getSecurity(),
).toBe(security);
});

Expand All @@ -108,10 +112,12 @@ describe('operation.getSecurity()', () => {
info: { version: '1.0' },
paths: {
'/things': {
'post': {}
post: {},
},
},
}).operation('/things', 'post').getSecurity(),
})
.operation('/things', 'post')
.getSecurity(),
).toEqual([]);
});
});
Expand Down
27 changes: 3 additions & 24 deletions packages/api-explorer-ui/src/CodeSampleResponse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const extensions = require('../../readme-oas-extensions');
const { getLangName } = require('./lib/generate-code-snippet');
const syntaxHighlighter = require('../../readme-syntax-highlighter');
const codemirror = require('../../readme-syntax-highlighter/codemirror');
const IconStatus = require('./sub-components/status-with-icon');

const Oas = require('./lib/Oas');

Expand Down Expand Up @@ -66,18 +67,7 @@ class CodeSampleResponse extends React.Component {
this.setTab('result');
}}
>
<span
className={classNames({
httpsuccess: result.statusCode[2] === 'success',
httperror: result.statusCode[2] !== 'success',
})}
>
<i className="fa fa-circle" />
<em>
&nbsp;{result.statusCode[0]}&nbsp;
{result.statusCode[1]}
</em>
</span>
<IconStatus result={result} />
</a>
}
{
Expand Down Expand Up @@ -199,18 +189,7 @@ class CodeSampleResponse extends React.Component {
<label> Status</label>
}
<span className="httpstatus">
<span
className={classNames({
httpsuccess: result.statusCode[2] === 'success',
httperror: result.statusCode[2] !== 'success',
})}
>
<i className="fa fa-circle" />
<em>
&nbsp;{result.statusCode[0]}&nbsp;
{result.statusCode[1]}
</em>
</span>
<IconStatus result={result} />
</span>
</div>

Expand Down
26 changes: 26 additions & 0 deletions packages/api-explorer-ui/src/sub-components/status-with-icon.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const React = require('react');
const PropTypes = require('prop-types');
const classNames = require('classnames');

function IconStatus({ result }) {
return (
<span
className={classNames({
httpsuccess: result.statusCode[2] === 'success',
httperror: result.statusCode[2] !== 'success',
})}
>
<i className="fa fa-circle" />
<em>
&nbsp;{result.statusCode[0]}&nbsp;
{result.statusCode[1]}
</em>
</span>
);
}

IconStatus.propTypes = {
result: PropTypes.shape({}).isRequired,
};

module.exports = IconStatus;

0 comments on commit a572f07

Please sign in to comment.