@@ -282,15 +282,15 @@ describe('SubmissionSectionFormComponent test suite', () => {
282282 expect ( comp . sectionData . errorsToShow ) . toEqual ( [ ] ) ;
283283 expect ( comp . sectionData . data ) . toEqual ( sectionData ) ;
284284 expect ( comp . isLoading ) . toBeFalsy ( ) ;
285- expect ( comp . initForm ) . toHaveBeenCalledWith ( sectionData ) ;
285+ expect ( comp . initForm ) . toHaveBeenCalledWith ( sectionData , [ ] , [ ] ) ;
286286 expect ( comp . subscriptions ) . toHaveBeenCalled ( ) ;
287287 } ) ;
288288
289289 it ( 'should init form model properly' , ( ) => {
290290 formBuilderService . modelFromConfiguration . and . returnValue ( testFormModel ) ;
291291 const sectionData = { } ;
292292
293- comp . initForm ( sectionData ) ;
293+ comp . initForm ( sectionData , [ ] , [ ] ) ;
294294
295295 expect ( comp . formModel ) . toEqual ( testFormModel ) ;
296296
@@ -305,7 +305,7 @@ describe('SubmissionSectionFormComponent test suite', () => {
305305 path : '/sections/' + sectionObject . id ,
306306 } ;
307307
308- comp . initForm ( sectionData ) ;
308+ comp . initForm ( sectionData , [ ] , [ ] ) ;
309309
310310 expect ( comp . formModel ) . toBeUndefined ( ) ;
311311 expect ( sectionsServiceStub . setSectionError ) . toHaveBeenCalledWith ( submissionId , sectionObject . id , sectionError ) ;
@@ -464,7 +464,7 @@ describe('SubmissionSectionFormComponent test suite', () => {
464464 compAsAny . formData = { } ;
465465 compAsAny . sectionMetadata = [ 'dc.title' ] ;
466466
467- comp . updateForm ( sectionData , sectionError ) ;
467+ comp . updateForm ( { data : sectionData , errorsToShow : sectionError } as any ) ;
468468
469469 expect ( comp . isUpdating ) . toBeFalsy ( ) ;
470470 expect ( comp . initForm ) . toHaveBeenCalled ( ) ;
@@ -476,15 +476,19 @@ describe('SubmissionSectionFormComponent test suite', () => {
476476 it ( 'should update form error properly' , ( ) => {
477477 spyOn ( comp , 'initForm' ) ;
478478 spyOn ( comp , 'checksForErrors' ) ;
479- const sectionData : any = {
479+ const sectionData = {
480480 'dc.title' : [ new FormFieldMetadataValueObject ( 'test' ) ] ,
481481 } ;
482+ const sectionState = {
483+ data : sectionData ,
484+ errorsToShow : [ { path : '/test' , message : 'test' } ] ,
485+ } as any ;
482486 comp . sectionData . data = { } ;
483487 comp . sectionData . errorsToShow = [ ] ;
484488 compAsAny . formData = sectionData ;
485489 compAsAny . sectionMetadata = [ 'dc.title' ] ;
486490
487- comp . updateForm ( sectionData , parsedSectionErrors ) ;
491+ comp . updateForm ( sectionState ) ;
488492
489493 expect ( comp . initForm ) . not . toHaveBeenCalled ( ) ;
490494 expect ( comp . checksForErrors ) . toHaveBeenCalled ( ) ;
@@ -495,8 +499,9 @@ describe('SubmissionSectionFormComponent test suite', () => {
495499 spyOn ( comp , 'initForm' ) ;
496500 spyOn ( comp , 'checksForErrors' ) ;
497501 const sectionData : any = { } ;
502+ const sectionErrors : any = [ { path : '/test' , message : 'test' } ] ;
498503
499- comp . updateForm ( sectionData , parsedSectionErrors ) ;
504+ comp . updateForm ( { data : sectionData , errorsToShow : sectionErrors } as any ) ;
500505
501506 expect ( comp . initForm ) . not . toHaveBeenCalled ( ) ;
502507 expect ( comp . checksForErrors ) . toHaveBeenCalled ( ) ;
@@ -562,7 +567,7 @@ describe('SubmissionSectionFormComponent test suite', () => {
562567 const sectionState = {
563568 data : sectionData ,
564569 errorsToShow : parsedSectionErrors ,
565- } ;
570+ } as any ;
566571
567572 formService . getFormData . and . returnValue ( observableOf ( formData ) ) ;
568573 sectionsServiceStub . getSectionState . and . returnValue ( observableOf ( sectionState ) ) ;
@@ -571,7 +576,7 @@ describe('SubmissionSectionFormComponent test suite', () => {
571576
572577 expect ( compAsAny . subs . length ) . toBe ( 2 ) ;
573578 expect ( compAsAny . formData ) . toEqual ( formData ) ;
574- expect ( comp . updateForm ) . toHaveBeenCalledWith ( sectionState . data , sectionState . errorsToShow ) ;
579+ expect ( comp . updateForm ) . toHaveBeenCalledWith ( sectionState ) ;
575580
576581 } ) ;
577582
0 commit comments