1- import { MockComponent } from 'ng-mocks' ;
2-
3- import { PLATFORM_ID } from '@angular/core' ;
41import { ComponentFixture , TestBed } from '@angular/core/testing' ;
52
63import { CedarMetadataHelper } from '@osf/features/metadata/helpers' ;
74import { CedarMetadataDataTemplateJsonApi } from '@osf/features/metadata/models' ;
8- import { LoadingSpinnerComponent } from '@osf/shared/components/loading-spinner/loading-spinner.component' ;
95
106import { CedarTemplateFormComponent } from './cedar-template-form.component' ;
117
@@ -20,8 +16,7 @@ describe('CedarTemplateFormComponent', () => {
2016
2117 beforeEach ( async ( ) => {
2218 await TestBed . configureTestingModule ( {
23- imports : [ CedarTemplateFormComponent , OSFTestingModule , MockComponent ( LoadingSpinnerComponent ) ] ,
24- providers : [ { provide : PLATFORM_ID , useValue : 'browser' } ] ,
19+ imports : [ CedarTemplateFormComponent , OSFTestingModule ] ,
2520 } ) . compileComponents ( ) ;
2621
2722 fixture = TestBed . createComponent ( CedarTemplateFormComponent ) ;
@@ -80,14 +75,10 @@ describe('CedarTemplateFormComponent', () => {
8075 expect ( emitSpy ) . toHaveBeenCalled ( ) ;
8176 } ) ;
8277
83- it ( 'should initialize form data with empty metadata when no existing record' , async ( ) => {
78+ it ( 'should initialize form data with empty metadata when no existing record' , ( ) => {
8479 fixture . componentRef . setInput ( 'existingRecord' , null ) ;
8580 fixture . detectChanges ( ) ;
8681
87- await ( component as any ) . loadCedarLibraries ( ) ;
88- ( component as any ) . initializeCedar ( ) ;
89- fixture . detectChanges ( ) ;
90-
9182 const expectedEmptyMetadata = CedarMetadataHelper . buildEmptyMetadata ( ) ;
9283 expect ( component . formData ( ) ) . toEqual ( expectedEmptyMetadata ) ;
9384 } ) ;
0 commit comments