Improving coverage in RavenError tests
This commit is contained in:
parent
d9af19ca63
commit
79191c0fd7
@ -31,18 +31,35 @@ describe('RavenError', () => {
|
|||||||
expect(Raven.captureException).toHaveBeenCalledWith(testError, testDetails);
|
expect(Raven.captureException).toHaveBeenCalledWith(testError, testDetails);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('error reporting', () => {
|
describe('error reporting', () => {
|
||||||
Raven.lastEventId.mockReturnValue(1);
|
test('clicking to fill out a report when an event has been logged', () => {
|
||||||
const component = shallow(
|
Raven.lastEventId.mockReturnValue(1);
|
||||||
<RavenError
|
const component = shallow(
|
||||||
error={ testError }
|
<RavenError
|
||||||
details={ testDetails }
|
error={ testError }
|
||||||
t={ translate }/>
|
details={ testDetails }
|
||||||
);
|
t={ translate }/>
|
||||||
const eventObj = { preventDefault: jest.fn() };
|
);
|
||||||
component.find('a').simulate('click', eventObj);
|
const eventObj = { preventDefault: jest.fn() };
|
||||||
|
component.find('a').simulate('click', eventObj);
|
||||||
|
|
||||||
expect(eventObj.preventDefault).toHaveBeenCalled();
|
expect(eventObj.preventDefault).toHaveBeenCalled();
|
||||||
expect(Raven.showReportDialog).toHaveBeenCalled();
|
expect(Raven.showReportDialog).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('clicking to fill out a report when an event has not been logged', () => {
|
||||||
|
Raven.lastEventId.mockReturnValue(false);
|
||||||
|
const component = shallow(
|
||||||
|
<RavenError
|
||||||
|
error={ testError }
|
||||||
|
details={ testDetails }
|
||||||
|
t={ translate }/>
|
||||||
|
);
|
||||||
|
const eventObj = { preventDefault: jest.fn() };
|
||||||
|
component.find('a').simulate('click', eventObj);
|
||||||
|
|
||||||
|
expect(eventObj.preventDefault).toHaveBeenCalled();
|
||||||
|
expect(Raven.showReportDialog).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user