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

Commit

Permalink
Add test for open logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dok committed Sep 28, 2018
1 parent ea7cd5b commit 67a5384
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/api-logs/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ describe('Logs', () => {
expect(instance.state.group).toBe('1230');
});

test('open window on log visit', () => {
const comp = shallow(<Logs {...props} />);
global.open = jest.fn();
const instance = comp.instance();
instance.visitLogItem(requestmodel);
expect(global.open).toBeCalled();
});

test('when parsed agent is not Other', () => {
const comp = shallow(<LogTest {...props} />);
requestmodel.request.log.entries[0].request.headers[0].value = 'IE4.0';
Expand Down
2 changes: 1 addition & 1 deletion packages/api-logs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Logs extends React.Component {

visitLogItem(log) {
const { baseUrl } = this.props;
window.location = `${baseUrl}logs/${log._id}`;
window.open(`${baseUrl}logs/${log._id}`);
}

renderLogs() {
Expand Down

0 comments on commit 67a5384

Please sign in to comment.