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

Commit a572f07

Browse files
committed
correct all build errors
1 parent b9640c7 commit a572f07

File tree

3 files changed

+44
-33
lines changed

3 files changed

+44
-33
lines changed

packages/api-explorer-ui/__tests__/lib/Oas.test.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,22 @@ test('should be able to access properties on oas', () => {
7171
});
7272

7373
describe('operation.getSecurity()', () => {
74-
const security = [{ 'auth': [] }];
74+
const security = [{ auth: [] }];
7575

7676
test('should return the security on this endpoint', () => {
7777
expect(
7878
new Oas({
7979
info: { version: '1.0' },
8080
paths: {
8181
'/things': {
82-
'post': {
82+
post: {
8383
security,
84-
}
84+
},
8585
},
86-
}
87-
}).operation('/things', 'post').getSecurity(),
86+
},
87+
})
88+
.operation('/things', 'post')
89+
.getSecurity(),
8890
).toBe(security);
8991
});
9092

@@ -94,11 +96,13 @@ describe('operation.getSecurity()', () => {
9496
info: { version: '1.0' },
9597
paths: {
9698
'/things': {
97-
'post': {}
99+
post: {},
98100
},
99101
},
100102
security,
101-
}).operation('/things', 'post').getSecurity(),
103+
})
104+
.operation('/things', 'post')
105+
.getSecurity(),
102106
).toBe(security);
103107
});
104108

@@ -108,10 +112,12 @@ describe('operation.getSecurity()', () => {
108112
info: { version: '1.0' },
109113
paths: {
110114
'/things': {
111-
'post': {}
115+
post: {},
112116
},
113117
},
114-
}).operation('/things', 'post').getSecurity(),
118+
})
119+
.operation('/things', 'post')
120+
.getSecurity(),
115121
).toEqual([]);
116122
});
117123
});

packages/api-explorer-ui/src/CodeSampleResponse.jsx

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const extensions = require('../../readme-oas-extensions');
88
const { getLangName } = require('./lib/generate-code-snippet');
99
const syntaxHighlighter = require('../../readme-syntax-highlighter');
1010
const codemirror = require('../../readme-syntax-highlighter/codemirror');
11+
const IconStatus = require('./sub-components/status-with-icon');
1112

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

@@ -66,18 +67,7 @@ class CodeSampleResponse extends React.Component {
6667
this.setTab('result');
6768
}}
6869
>
69-
<span
70-
className={classNames({
71-
httpsuccess: result.statusCode[2] === 'success',
72-
httperror: result.statusCode[2] !== 'success',
73-
})}
74-
>
75-
<i className="fa fa-circle" />
76-
<em>
77-
&nbsp;{result.statusCode[0]}&nbsp;
78-
{result.statusCode[1]}
79-
</em>
80-
</span>
70+
<IconStatus result={result} />
8171
</a>
8272
}
8373
{
@@ -199,18 +189,7 @@ class CodeSampleResponse extends React.Component {
199189
<label> Status</label>
200190
}
201191
<span className="httpstatus">
202-
<span
203-
className={classNames({
204-
httpsuccess: result.statusCode[2] === 'success',
205-
httperror: result.statusCode[2] !== 'success',
206-
})}
207-
>
208-
<i className="fa fa-circle" />
209-
<em>
210-
&nbsp;{result.statusCode[0]}&nbsp;
211-
{result.statusCode[1]}
212-
</em>
213-
</span>
192+
<IconStatus result={result} />
214193
</span>
215194
</div>
216195

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const React = require('react');
2+
const PropTypes = require('prop-types');
3+
const classNames = require('classnames');
4+
5+
function IconStatus({ result }) {
6+
return (
7+
<span
8+
className={classNames({
9+
httpsuccess: result.statusCode[2] === 'success',
10+
httperror: result.statusCode[2] !== 'success',
11+
})}
12+
>
13+
<i className="fa fa-circle" />
14+
<em>
15+
&nbsp;{result.statusCode[0]}&nbsp;
16+
{result.statusCode[1]}
17+
</em>
18+
</span>
19+
);
20+
}
21+
22+
IconStatus.propTypes = {
23+
result: PropTypes.shape({}).isRequired,
24+
};
25+
26+
module.exports = IconStatus;

0 commit comments

Comments
 (0)