11import { TestBed } from '@angular/core/testing' ;
22import { BuilderService , ElementService , NodeService } from '../classes' ;
33import { BuilderComponent } from './builder.component' ;
4+ import { LocalizationProviderService } from '../services' ;
45
56describe ( 'BuilderComponent' , ( ) => {
67 beforeEach ( async ( ) => {
@@ -9,23 +10,52 @@ describe('BuilderComponent', () => {
910 providers : [
1011 {
1112 provide : BuilderService ,
12- useValue : { } ,
13+ useValue : {
14+ restore : jasmine . createSpy ( 'restore' ) . and . returnValue (
15+ Promise . resolve ( {
16+ events : [ ] ,
17+ actions : [ ] ,
18+ elseActions : [ ] ,
19+ groups : [ ] ,
20+ process : { id : 'test-process' } ,
21+ state : { } ,
22+ } ) ,
23+ ) ,
24+ } ,
1325 } ,
1426 {
1527 provide : NodeService ,
16- useValue : { } ,
28+ useValue : {
29+ getGroups : jasmine . createSpy ( 'getGroups' ) . and . returnValue ( [ ] ) ,
30+ } ,
1731 } ,
1832 {
1933 provide : ElementService ,
2034 useValue : { } ,
2135 } ,
36+ {
37+ provide : LocalizationProviderService ,
38+ useValue : {
39+ setLocalizedStrings : jasmine . createSpy ( 'setLocalizedStrings' ) ,
40+ getLocalizedString : ( key : string ) => key ,
41+ } ,
42+ } ,
2243 ] ,
2344 } ) . compileComponents ( ) ;
2445 } ) ;
2546
2647 it ( 'should create' , ( ) => {
2748 const fixture = TestBed . createComponent ( BuilderComponent ) ;
2849 const app = fixture . componentInstance ;
50+
51+ // Set required inputs
52+ fixture . componentRef . setInput ( 'state' , { } ) ;
53+ fixture . componentRef . setInput ( 'localizedStringMap' , { } ) ;
54+ fixture . componentRef . setInput ( 'diagram' , '' ) ;
55+ fixture . componentRef . setInput ( 'templateMap' , { } ) ;
56+ fixture . componentRef . setInput ( 'allColumns' , [ ] ) ;
57+
58+ fixture . detectChanges ( ) ;
2959 expect ( app ) . toBeTruthy ( ) ;
3060 } ) ;
3161} ) ;
0 commit comments