diff --git a/packages/api-explorer-ui/__tests__/CodeSampleResponse.test.jsx b/packages/api-explorer-ui/__tests__/CodeSampleResponse.test.jsx
index 3ee856b30..399236092 100644
--- a/packages/api-explorer-ui/__tests__/CodeSampleResponse.test.jsx
+++ b/packages/api-explorer-ui/__tests__/CodeSampleResponse.test.jsx
@@ -166,8 +166,6 @@ describe('Results body', () => {
,
);
- console.log(codeSampleResponseTabs.find('.hub-expired-token').html());
-
expect(codeSampleResponseTabs.find('.hub-expired-token').length).toEqual(1);
expect(
codeSampleResponseTabs.containsMatchingElement(
@@ -203,7 +201,14 @@ describe('Results body', () => {
/>,
);
- expect(codeSampleResponseTabs.find('a.btn btn-primary').length).toEqual(1);
+ expect(
+ codeSampleResponseTabs.containsAllMatchingElements([
+
,
+ ]),
+ ).toEqual(true);
});
test('should display message authentication message if endpoint does not use oAuth', async () => {
diff --git a/packages/api-explorer-ui/src/CodeSampleResponse.jsx b/packages/api-explorer-ui/src/CodeSampleResponse.jsx
index d42e569b6..9f20e13a1 100644
--- a/packages/api-explorer-ui/src/CodeSampleResponse.jsx
+++ b/packages/api-explorer-ui/src/CodeSampleResponse.jsx
@@ -129,7 +129,7 @@ class CodeSampleResponse extends React.Component {
{result.statusCode[0] === 401 && (
{securities.OAuth2 ? (
- () => {
+ (() => {
if (oauthUrl) {
return (
@@ -141,7 +141,7 @@ class CodeSampleResponse extends React.Component {
);
}
return
Your OAuth2 token is incorrect or has expired
;
- }
+ })()
) : (
You couldn't be authenticated
)}