1- jest . mock ( '@slickgrid-universal/common/dist/commonjs/formatters/formatterUtilities' ) ;
21import 'jest-extended' ;
32import { ApplicationRef , ChangeDetectorRef , ElementRef } from '@angular/core' ;
43import { TestBed } from '@angular/core/testing' ;
54import { TranslateService , TranslateModule } from '@ngx-translate/core' ;
65import {
6+ autoAddEditorFormatterToColumnsWithEditor ,
77 BackendService ,
88 BackendServiceApi ,
99 BackendUtilityService ,
@@ -39,7 +39,6 @@ import {
3939 TreeDataService ,
4040 SlickGroupItemMetadataProvider
4141} from '@slickgrid-universal/common' ;
42- import * as formatterUtilities from '@slickgrid-universal/common/dist/commonjs/formatters/formatterUtilities' ;
4342import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component' ;
4443import { EventPubSubService } from '@slickgrid-universal/event-pub-sub' ;
4544import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component' ;
@@ -54,6 +53,11 @@ import { GridOption } from '../../models';
5453import { MockSlickEvent , MockSlickEventHandler } from '../../../../../../test/mockSlickEvent' ;
5554import { RxJsResourceStub } from '../../../../../../test/rxjsResourceStub' ;
5655
56+ jest . mock ( '@slickgrid-universal/common' , ( ) => ( {
57+ ...( jest . requireActual ( '@slickgrid-universal/common' ) as any ) ,
58+ autoAddEditorFormatterToColumnsWithEditor : jest . fn ( ) ,
59+ } ) ) ;
60+
5761declare const Slick : any ;
5862const slickEventHandler = new MockSlickEventHandler ( ) ;
5963jest . mock ( 'flatpickr' , ( ) => { } ) ;
@@ -538,7 +542,7 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
538542 component . ngAfterViewInit ( ) ;
539543
540544 expect ( component ) . toBeTruthy ( ) ;
541- // expect(formatterUtilities. autoAddEditorFormatterToColumnsWithEditor).toHaveBeenCalledWith([{ id: 'name', field: 'name', editor: undefined, internalColumnEditor: {} }], customEditableInputFormatter);
545+ expect ( autoAddEditorFormatterToColumnsWithEditor ) . toHaveBeenCalledWith ( [ { id : 'name' , field : 'name' , editor : undefined , internalColumnEditor : { } } ] , customEditableInputFormatter ) ;
542546 } ) ;
543547 } ) ;
544548
@@ -565,7 +569,6 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
565569 const autosizeSpy = jest . spyOn ( mockGrid , 'autosizeColumns' ) ;
566570 const updateSpy = jest . spyOn ( component , 'updateColumnDefinitionsList' ) ;
567571 const renderSpy = jest . spyOn ( extensionServiceStub , 'renderColumnHeaders' ) ;
568- const autoAddFormatterSpy = jest . spyOn ( formatterUtilities , 'autoAddEditorFormatterToColumnsWithEditor' ) ;
569572 const mockColDefs = [ { id : 'name' , field : 'name' , editor : undefined , internalColumnEditor : { } } ] ;
570573
571574 component . ngAfterViewInit ( ) ;
@@ -577,7 +580,7 @@ describe('Angular-Slickgrid Custom Component instantiated via Constructor', () =
577580 expect ( autosizeSpy ) . toHaveBeenCalled ( ) ;
578581 expect ( updateSpy ) . toHaveBeenCalledWith ( mockColDefs ) ;
579582 expect ( renderSpy ) . toHaveBeenCalledWith ( mockColDefs , true ) ;
580- // expect(autoAddFormatterSpy ).toHaveBeenCalledWith([{ id: 'name', field: 'name', editor: undefined, internalColumnEditor: {} }], customEditableInputFormatter);
583+ expect ( autoAddEditorFormatterToColumnsWithEditor ) . toHaveBeenCalledWith ( [ { id : 'name' , field : 'name' , editor : undefined , internalColumnEditor : { } } ] , customEditableInputFormatter ) ;
581584 } ) ;
582585 } ) ;
583586
0 commit comments