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