mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-22 06:17:47 +00:00
Fix Raven tests
This commit is contained in:
parent
6f0de11bda
commit
f893714d69
@ -19,6 +19,6 @@
|
||||
</main>
|
||||
|
||||
<footer class="footer mat-app-background">
|
||||
GNS3 Web UI demo © 2017
|
||||
GNS3 Web UI demo © 2018
|
||||
</footer>
|
||||
|
||||
|
@ -11,6 +11,7 @@ import { environment } from "../environments/environment";
|
||||
describe('RavenErrorHandler', () => {
|
||||
let handler: RavenErrorHandler;
|
||||
let settingsService: SettingsService;
|
||||
const inProductionOriginal = environment.production;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@ -21,6 +22,10 @@ describe('RavenErrorHandler', () => {
|
||||
handler = TestBed.get(RavenErrorHandler);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
environment.production = inProductionOriginal;
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(handler).toBeTruthy();
|
||||
});
|
||||
@ -29,14 +34,14 @@ describe('RavenErrorHandler', () => {
|
||||
settingsService.set('crash_reports', true);
|
||||
const error = new Error("My error");
|
||||
const captureException = spyOn(Raven, 'captureException');
|
||||
spyOn(environment, 'production').and.returnValue(true);
|
||||
environment.production = true;
|
||||
handler.handleError(error);
|
||||
expect(captureException).toHaveBeenCalledWith(error);
|
||||
});
|
||||
|
||||
it('should not handle when not in production', () => {
|
||||
const captureException = spyOn(Raven, 'captureException');
|
||||
spyOnProperty(environment, 'production').and.returnValue(false);
|
||||
environment.production = false;
|
||||
handler.handleError(new Error("My error"));
|
||||
expect(captureException).not.toHaveBeenCalled();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user