mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Migrate from window.console to LogService
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { CoreModule } from 'ng2-alfresco-core';
|
||||
import { CoreModule, LogServiceMock } from 'ng2-alfresco-core';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { DisplayValueWidget } from './display-value.widget';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
@@ -32,11 +32,13 @@ describe('DisplayValueWidget', () => {
|
||||
let widget: DisplayValueWidget;
|
||||
let formService: FormService;
|
||||
let visibilityService: WidgetVisibilityService;
|
||||
let logService: LogServiceMock;
|
||||
|
||||
beforeEach(() => {
|
||||
formService = new FormService(null, null);
|
||||
visibilityService = new WidgetVisibilityService(null);
|
||||
widget = new DisplayValueWidget(formService, visibilityService);
|
||||
logService = new LogServiceMock();
|
||||
formService = new FormService(null, null, logService);
|
||||
visibilityService = new WidgetVisibilityService(null, logService);
|
||||
widget = new DisplayValueWidget(formService, visibilityService, logService);
|
||||
});
|
||||
|
||||
it('should require field to setup default value', () => {
|
||||
@@ -390,7 +392,7 @@ describe('DisplayValueWidget', () => {
|
||||
Observable.throw(error)
|
||||
);
|
||||
|
||||
spyOn(console, 'log').and.stub();
|
||||
spyOn(logService, 'error').and.stub();
|
||||
|
||||
let form = new FormModel({taskId: '<id>'});
|
||||
|
||||
@@ -406,7 +408,7 @@ describe('DisplayValueWidget', () => {
|
||||
});
|
||||
widget.ngOnInit();
|
||||
expect(formService.getRestFieldValues).toHaveBeenCalled();
|
||||
expect(console.log).toHaveBeenCalledWith(error);
|
||||
expect(logService.error).toHaveBeenCalledWith(error);
|
||||
expect(widget.value).toBe('100');
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user