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

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
domharrington committed Dec 21, 2018
1 parent 786a244 commit 824bcc1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
24 changes: 19 additions & 5 deletions packages/api-logs/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@ describe('Logs', () => {
test('should fetch based on query with page/limit', async () => {
const comp = shallow(<Logs {...props} />);

const mock = nock('https://metrics.readme.io:443', {"encodedQueryParams":true})
const mock = nock('https://metrics.readme.io:443', { encodedQueryParams: true })
.get('/api/logs')
.query({ url: 'https%3A%2F%2Fdash.readme.io%2Fapi%2Fv1%2Fdocs%2F%7Bslug%7D', id: null, method: 'delete', limit: 5, page: 0 })
.query({
url: 'https%3A%2F%2Fdash.readme.io%2Fapi%2Fv1%2Fdocs%2F%7Bslug%7D',
id: null,
method: 'delete',
limit: 5,
page: 0,
})
.reply(200, [requestmodel]);

await comp.instance().getData();
Expand All @@ -79,9 +85,15 @@ describe('Logs', () => {
test('should fetch with group if passed', async () => {
const comp = shallow(<Logs {...props} />);

const mock = nock('https://metrics.readme.io:443', {"encodedQueryParams":true})
const mock = nock('https://metrics.readme.io:443', { encodedQueryParams: true })
.get('/api/logs')
.query({ url: 'https%3A%2F%2Fdash.readme.io%2Fapi%2Fv1%2Fdocs%2F%7Bslug%7D', id: 'someid', method: 'delete', limit: 5, page: 0 })
.query({
url: 'https%3A%2F%2Fdash.readme.io%2Fapi%2Fv1%2Fdocs%2F%7Bslug%7D',
id: 'someid',
method: 'delete',
limit: 5,
page: 0,
})
.reply(200, [requestmodel]);

await comp.instance().getData('someid');
Expand All @@ -91,7 +103,9 @@ describe('Logs', () => {

test('should render a "view more" button', () => {
const comp = shallow(<LogTest {...props} />);
expect(comp.find('a[target="_blank"]').prop('href')).toBe('https://metrics.readme.io/logs?url=https%3A%2F%2Fdash.readme.io%2Fapi%2Fv1%2Fdocs%2F%7Bslug%7D&method=delete&id=someid');
expect(comp.find('a[target="_blank"]').prop('href')).toBe(
'https://metrics.readme.io/logs?url=https%3A%2F%2Fdash.readme.io%2Fapi%2Fv1%2Fdocs%2F%7Bslug%7D&method=delete&id=someid',
);
});

test('should render with id', () => {
Expand Down
10 changes: 8 additions & 2 deletions packages/api-logs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ class Logs extends React.Component {
const { query, baseUrl } = this.props;
this.setState({ loading: true });

const reqUrl = `${baseUrl}api/logs?${querystring.stringify(Object.assign({}, query, { id: group || null, limit: 5, page: 0 }))}`;
const reqUrl = `${baseUrl}api/logs?${querystring.stringify(
Object.assign({}, query, { id: group || null, limit: 5, page: 0 }),
)}`;

return fetch(reqUrl).then(res => {
return this.handleData(res);
Expand Down Expand Up @@ -158,7 +160,11 @@ class Logs extends React.Component {
}

static renderOption(item) {
return <option key={item.id} value={item.id}>{item.name}</option>;
return (
<option key={item.id} value={item.id}>
{item.name}
</option>
);
}

renderSelect() {
Expand Down

0 comments on commit 824bcc1

Please sign in to comment.