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

Commit

Permalink
Pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uppal101 committed Oct 30, 2017
1 parent 6725ee1 commit 173a3e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions packages/api-explorer-ui/__tests__/CodeSampleResponse.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ describe('Results body', () => {
<CodeSampleResponseTabs {...oauthInvalidResponse} oas={oas} />,
);

console.log(codeSampleResponseTabs.find('.hub-expired-token').html());

expect(codeSampleResponseTabs.find('.hub-expired-token').length).toEqual(1);
expect(
codeSampleResponseTabs.containsMatchingElement(
Expand Down Expand Up @@ -203,7 +201,14 @@ describe('Results body', () => {
/>,
);

expect(codeSampleResponseTabs.find('a.btn btn-primary').length).toEqual(1);
expect(
codeSampleResponseTabs.containsAllMatchingElements([
<div>
<p>Your OAuth2 token has expired</p>
<a>Reauthenticate via OAuth2</a>
</div>,
]),
).toEqual(true);
});

test('should display message authentication message if endpoint does not use oAuth', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-explorer-ui/src/CodeSampleResponse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class CodeSampleResponse extends React.Component {
{result.statusCode[0] === 401 && (
<div className="text-center hub-expired-token">
{securities.OAuth2 ? (
() => {
(() => {
if (oauthUrl) {
return (
<div>
Expand All @@ -141,7 +141,7 @@ class CodeSampleResponse extends React.Component {
);
}
return <p>Your OAuth2 token is incorrect or has expired</p>;
}
})()
) : (
<p>You couldn&apos;t be authenticated</p>
)}
Expand Down

0 comments on commit 173a3e6

Please sign in to comment.